Commit graph

2369 commits

Author SHA1 Message Date
Brian C. Lane
f164bfb272 cloudapi: blueprint must have a name 2022-09-30 17:42:07 +02:00
Brian C. Lane
d42d5fa17f blueprints: Fix commit message when version is empty
With an empty or missing version number the commit message would not
include the version (which is set to 0.0.0 by calling Initialize).  This
adds a call to Initialize() in the API code before constructing the
commit message. It also moves the check for non-empty blueprint name
into the Initialize call where it belongs.
2022-09-30 17:42:07 +02:00
Brian C. Lane
b1461c91bb store: Fix TagBlueprint
This fixes a bug where tagging a blueprint would overwrite the blueprint
in the blueprintChanges storage with an older version of the blueprint.
It also adds checks to make sure the blueprint is present in the
blueprintsCommits and blueprintsChanges maps before trying to reference
them -- just in case something in the store gets out of sync.
2022-09-30 11:49:52 +02:00
Brian C. Lane
6ebe871710 tests: Fix TestTagBlueprint to fail properly
TagBlueprint has a bug, it replaces the tagged blueprint with the last
untagged blueprint. The test wasn't testing for this, so correct that
before fixing the actual bug.
2022-09-30 11:49:52 +02:00
Achilleas Koutsou
6f89e9d499 fedora: add "rw" to kernel options for iot-raw-image
Needed when /sysroot is mounted read-only to keep other (stateful)
parts of the filesystem (/var and /etc) writeable.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
445de61a80 manifest: move ostree config stage after the deployment
Configure ostree after it's deployed and add the ostree mount.
This fixes sysroot not being mounted 'ro' in the final image when it's
booted.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
aec3ef4161 image: update ostree installer to use new pipelines
Fedora iot-installer now uses the new ostree installer pipelines that no
longer use the bootiso.mono stage.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
254a3b16d4 manifest: use internal ostree package struct in bootiso-tree 2022-09-29 18:09:38 +02:00
Achilleas Koutsou
14f608de0a osbuild: use internal users package structs in stages
Don't pass blueprint Users and Groups options all the way down to the
osbuild stage bindings.  Instead, convert them to the internal
users.User and users.Group structs.
Ideally we would do this even higher up in the code path, before
reaching the distro, but this is the first step towards that.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
5bf4b2ab98 manifest: delete bootiso.mono option helper function 2022-09-29 18:09:38 +02:00
Achilleas Koutsou
a1bfcfe91c manifest: update bootiso-tree pipeline to use new stages
- Use newer granular stages to build the bootiso tree rather than the
  deprecated bootiso.mono stage.
- Adjust the ISOTree struct properties: add the ones needed by the new
  stages and remove any properties that have been moved to the new
  pipelines.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
c549742c02 manifest: new pipeline for creating an EFI boot tree
Contains a single stage that creates an boot filesystem tree, that can
be consumed to create an efiboot.img.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
d27bdac369 manifest: new pipeline for building ISO rootfs.img 2022-09-29 18:09:38 +02:00
Achilleas Koutsou
c0fcbfc5c2 osbuild: add isolinux stage
Add support for the org.osbuild.isolinux stage.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
204b4177ec osbuild: add squashfs stage
Add support for the org.osbuild.squashfs stage.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
3d772b6846 osbuild: simplify and unify tree stage inputs
- Remove stage-specific input types when they are org.osbuild.tree input
  types.
- Use PipelineTreeInputs when stage requires a single tree input
  reference with an arbitrary key.
- For Stages that require a specific key with a tree input, make the key
  part of the NewXStage() function and only allow specifying the name of
  the pipeline from which to copy the tree as part of the function
  arguments.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
ca0175c82b osbuild: function for creating named pipeline tree inputs
Convenience function for creating a map with a single input pointing to
a pipeline's tree with a given key.
Different stages use different keys in the map (often "tree").
Functions will be added for each stage to create a map with the
appropriate key when necessary.
2022-09-29 18:09:38 +02:00
Achilleas Koutsou
58966e4b13 osbuild: fix tree input schema
The references field in org.osbuild.tree inputs currently supports one
of three forms, all of which are functionally equivalent:
- Array of one string
- Array of one object with key "id" and string value
- Single object with no properties (only key/name)

We use the first form which is the simplest.

The string should refer to a pipeline by name (as name:<pipelinename>),
which means the input refer to the final tree of the named pipeline.
2022-09-29 18:09:38 +02:00
Irene Diez
0f8ed4e04b distro/rhel90: edge images default to LVM
Change partition tables on edgeBase images to use
'LVM partitioning'. We need to ensure that LVM
stages are done before LUKS stages (e.g. remove-key)
or the pipelines will break (we cannot open a device
when its password has changed).

Add relevant tests on device_test.go plus a new
test partition table on common_test.go
2022-09-22 10:20:27 +02:00
Achilleas Koutsou
fc4450cfbf cloudapi: add fedora iot image types
All except installer, which needs to be fixed.
2022-09-20 18:29:28 +02:00
Achilleas Koutsou
f9c37a167a fedora: make fedora-iot-... names the aliases
Remove the 'fedora' prefix from the canonical name for fedora-iot image
types.  Make the previous names aliases.
This has little functional change since we're simply swapping the
canonical name with an existing alias.
2022-09-20 18:29:28 +02:00
Ondřej Budai
d78f1e6229 cloudapi: add option to upload S3 artifacts publicly
A small test is added to cover this new option. Also, a check for AWS region
in the URL was removed. The public URL doesn't actually contain it and it's
imho useless - S3 buckets are always tied to a certain region.

The elaborate grep command parsing a path from a URI was switched to being
a small python script. The python script can actually handle an URI without
a query (which was always present in the pre-signed URI, but it's not in the
ordinary one)

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-09-19 22:56:36 +02:00
Ondřej Budai
54e2c2304c worker: add an option to upload public objects to aws.s3 target
If the object is marked as public, its direct download URL will be returned
instead of the presigned one.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-09-19 22:56:36 +02:00
Ondřej Budai
0e6c132ee6 awscloud: add option to mark S3 object as public
By setting the object's ACL to "public-read", anyone can download the object
even without authenticating with AWS.

The osbuild-upload-generic-s3 command got a new -public argument that
uses this new feature.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-09-19 22:56:36 +02:00
Ondřej Budai
381bce9ac0 awscloud: close the file after it's uploaded to S3
Oops, this was forgotten.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-09-19 22:56:36 +02:00
Tomáš Hozza
fd1850de40 distro: use storage capacity multiple constants in partition tables 2022-09-15 20:39:40 +02:00
Brian C. Lane
561bbbbdf3 azure: storageErr is already azblob.StorageError type 2022-09-15 03:57:40 -07:00
Brian C. Lane
7bae91eb9a gcp: Placeholder credential string is not a hardcoded credential 2022-09-15 03:57:40 -07:00
Brian C. Lane
0298dc85ab azure: Add note that azure-sdk-for-go module is deprecated 2022-09-15 03:57:40 -07:00
Brian C. Lane
cf18e2990a distro: Fix bug found by linting
Using new() to create a new struct assigns an empty struct to the
variable, meaning it can never be tested for nil. This means this code
would never detect a missing kernel package.
2022-09-15 03:57:40 -07:00
Brian C. Lane
826e9d8cc6 osbuild-composer: Set ReadHeaderTimeout to 5s
This satisfies the linter complaint about potential Slowloris attack
where headers are read slowly in an attempt to DoS the server.

The uses of ListenAndServe are only for testing purposes and are not run
in the production server so ignore the lint errors in
osbuild-mock-openid-provider.
2022-09-15 03:57:40 -07:00
Brian C. Lane
dfb69dc8e7 golangci-lint: The parameters passed to exec.Command are safe
None of these parameters are user controlled, they are either
constructed from paths or are constants.
2022-09-15 03:57:40 -07:00
Brian C. Lane
9827126d30 dnfjson: Add dnf-json result cache to BaseSolver
This is used to cache the results of dump and search requests for 60s.
Once the timeout has passed the request is repeated and the timeout
reset. The timeout is *not* reset on every cache hit which prevents, for
example, a request every 59 seconds from keeping the cache from
updating.

When the existing CleanCache() function is called to check the on-disk
metadata cache it will also delete any expired entries from the
resultCache in order to keep it from eventually consuming all memory.
2022-09-15 11:34:39 +01:00
Brian C. Lane
e307a8174a dnfjson: Add Hash functions to repoConfig and Request
These will be used to generate a unique hash to be used with the cache
of dnf-json results.
2022-09-15 11:34:39 +01:00
Brian C. Lane
35059ca60e dnfjson: Add a cache of dnf-json results
This adds a cache structure with timeout handling and cache cleanup.
Also adds some testing of the new functions.
2022-09-15 11:34:39 +01:00
Tomas Hozza
f4aed3e6e2 distro/rhel8: use azure-rhui pkg set and image config for vhd
Extract the non-RHUI specific package set and image configuration into a
common definitions, which will be used by both image types.

Redefine the package sets and default image configuration used by both
image types to inherit from a common definition.

Regenerate image manifests for RHEL-8 / c8s `vhd` and `azure-rhui`
images.

There is no change in the resulting manifest for the `azure-rhui` image
type. However there are substantial changes to the `vhd` image
definition, which is now almost identical to the `azure-rhui` image
type, to provide consistent experience regardless if using RHUI or not.

The default partition table used by the `vhd` image type has been kept
as it was before, since there is yet no consensus on what size to
standardize for both image types.
2022-09-15 08:50:33 +02:00
Tomas Hozza
b4abacbaa2 distro/rhel9: use azure-rhui pkg set and image config for vhd
Extract the non-RHUI specific package set and image configuration into a
common definitions, which will be used by both image types.

Redefine the package sets and default image configuration used by both
image types to inherit from a common definition.

Regenerate image manifests for RHEL-9 / c9s `vhd` and `azure-rhui`
images.

There is no change in the resulting manifest for the `azure-rhui` image
type. However there are substantial changes to the `vhd` image
definition, which is now almost identical to the `azure-rhui` image
type, to provide consistent experience regardless if using RHUI or not.

The default partition table used by the `vhd` image type has been kept
as it was before, since there is yet no consensus on what size to
standardize for both image types.
2022-09-15 08:50:33 +02:00
Tomas Hozza
b15def6c02 distro/rhel8: move all Azure / VHD code to a separate file
Move all code related to Azure / VHD images to a separate file,
similarly as it is done in rhel7 distro. This approach makes it easier
to find all the code related to a specific image type family.
2022-09-15 08:50:33 +02:00
Tomas Hozza
14868fe942 distro/rhel9: move all Azure / VHD code to a separate file
Move all code related to Azure / VHD images to a separate file,
similarly as it is done in rhel7 distro. This approach makes it easier
to find all the code related to a specific image type family.
2022-09-15 08:50:33 +02:00
Tomas Hozza
4b25fa73bc distro: use storage unit constants from the common package
Don't redefine the storage unit multiples in each distro, but use the
constants defined in the `common` package. This will make it easier to
split related image type definitions into separate files.
2022-09-15 08:50:33 +02:00
Tomas Hozza
ff28b0f5d3 common: define storage units as constants
Define all used storage units as constants. Use them in
`DataSizeToUint64()`, instead of literal multiples.
2022-09-15 08:50:33 +02:00
Achilleas Koutsou
2001b23610 fedora: conditional greenboot package names
Greenboot for Fedora 35 and older has several optional subpackages.
Starting with v36, there is only the 'greenboot-default-health-checks'
subpackage.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
91e581462b common: move VersionLessThan() util function
Move VersionLessThan() utility function to the common package to be
reused.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
6cd3a34099 image: add users and groups to edge/iot raw images 2022-09-13 16:06:19 +01:00
Achilleas Koutsou
5bc66f0665 manifest: add Users and Groups to OSTreeDeployment
Support creating users and groups during deployment of the commit to a
live image.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
40c91d7285 manifest: drop blueprint User and Group types from OS
Use the new internal types for setting users and groups in images.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
820d3d0277 users: convenience functions for converting from BP
The types currently map directly, so it's simple to convert from one to
the other.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
86d9611f98 osbuild: generator functions for UsersStage and GroupsStage
Generators for creating UsersStage and GroupsStage from the new internal
types.
These are almost identical to the existing stage option creation
functions.  Those will be removed once every use is replaced with the
new generators.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
e8c242db81 users: new package for internal User and Group types
New types that represent a User or Group for internal representation.
These are meant to be used as intermediate representations between API
or Blueprint user customizations and the final OSBuild stage options.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
0c77e4be60 manifest: rpm stage options for ostree commits
When building a fedora ostree commit, set the new ostree_booted flag in
the rpm stage and the dbpath to /usr/share/rpm
2022-09-13 16:06:19 +01:00