Commit graph

2393 commits

Author SHA1 Message Date
Achilleas Koutsou
abdddc6e55 osbuild: fix gpgkeys json key in ostree source 2022-10-12 03:07:40 +02:00
Tomáš Hozza
dc476671e4 weldr/upload/gcp: make Object optional
Previously, it was expected from the user to provide the Object name
when uploading image to GCP. The object name does not matter much,
because the object is deleted once image import finishes. Make
the specification of the object name optional and generate it if not
provided.

Adjust the GCP Weldr test case to not provide the Object name when
uploading the image.

The user can still provide the Object name if needed.
2022-10-11 13:23:18 +02:00
Tomáš Hozza
809107cd45 cloudapi: make Bucket optional in GCPUploadOptions
GCP Bucket to use can be now configured in the worker configuration.
Make the `Bucket` optional in the Cloud API when uploading image to GCP.

Adjust the Cloud API test case to configure GCP Bucket on the worker and
not provide it in the API request.
2022-10-11 13:23:18 +02:00
Tomáš Hozza
ad34043087 internal/target/gcp: make Bucket optional
The Bucket can now be set also in the worker configuration.
2022-10-11 13:23:18 +02:00
Tomáš Hozza
13f0894094 worker/aws: don't generate object key in worker
There is a desire to make the worker as "dumb" as possible. Therefore it
is not desired to generate the AWS object key names in the worker if it
was not provided in the job.

Modify the worker code to not generate the AWS object key in any case
and instead set an error in case the object key was not provided.

Modify Weldr API implementation to generate the object key, if it was
not provided by the user. This is consistent with Cloud API
implementation.
2022-10-11 13:23:18 +02:00
Achilleas Koutsou
7ebe3f550c distro/rhel: set ostree sysroot.readonly to false
We used to always set the sysroot.readonly setting to true, but this
never worked because of a bug in osbuild [1].
The bug is now fixed and the RHEL and CentOS edge-raw images are crated
with sysroot.readonly = true, and the images aren't booting.

Fixing the option to false.  This changes the manifests, but not the
generated images because of the change in osbuild.

If sysroot is meant to be readonly, we will change it in a future
update.

[1] https://github.com/osbuild/osbuild/pull/1129
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
97dddd24a5 fedora: remove BIOS boot for IoT raw images 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
e6c7815d41 fedora: use product and os version for discinfo release field
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
1324f7fb8c osbuild: simplify copy stage test 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
547f7a66b3 fedora: set sysroot read-only only for Fedora 37+ iot-raw-image 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
785f9cb7dd manifest: remove private osTreeCommit type
Use the ostree.CommitSpec type instead and return it directly from the
pipeline attributes when needed.
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
d32dff14b4 image: make read only sysroot optional for OSTreeRawImage 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
4ae8304bd2 image: make ostree commit mandatory in the OSTreeRawImage
Make the ostree commit spec mandatory in the OSTreeRawImage by adding it
to the constructor.

Use the ostree.CommitSpec to specify parameters in the OSTreeRawImage
ImageKind and the OSTreeDeployment Pipeline.
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
5f98d7082c manifest: make ostree commit spec mandatory in the OSTreeInstaller
Make the ostree commit spec mandatory in the OSTreeInstaller ImageKind.
The installer image type is not just for ostree types so make the ostree
parameters optional for the ISOTree Pipeline.

Use the ostree.CommitSpec to specify commits parameters.
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
711fc697e4 manifest: minor docstring spacing fix 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
99952afbd4 Separate ostree ref from parent spec in Pipelines and ImageKinds
In the OS pipeline, the parent configuration was used to detect if the
pipeline's setup was meant for an ostree commit or not.  Also, the
pipeline used a new type to specify the ostree parameters.

- Use the ostree.CommitSpec for the parent configuration.
- Add a new attribute, OSTreeRef, that defines the ref for the ostree
  commit being built.  An empty string indicates that the tree is not
  for an ostree commit.

Additionally, in the ImageKind configurations for the ostree archive and
container, separate the ostree ref from the parent spec, make the parent
spec optional (pointer) and the ostree ref mandatory, by requiring it in
the constructor of the ImageKind.
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
390ae15eaa distro: replace ostree.RequestParams with new OSTreeImageOptions
Instead of using the ostree.RequestParams in the OSTReeImageOptions,
define a new struct specific to ImageOptions for the ostree parameters.
This is almost identical to the new ostree.CommitSpec but the meaning of
the parameters changes based on image type and it would not be clear if
the CommitSpec was used in all cases.  For example, the parameters of
the new OSTreeImageOptions do not always refer to the same commit.  The
URL and Checksum may point to a parent commit to be pulled in to base
the new commit on, while the Ref refers to the new commit that will be
built (which may have a different ref from the parent).

The ostree.ResolveParams() function now returns two strings, the
resolved ref, which is replaced by the defaultRef if it's not specified
in the request, and the resolved parent checksum if a URL is specified.
The URL does not need to be returned since it's always the same as the
one specified in the request.
The function has been rewritten to make the logic more clear.
The docstring for the function has been rewritten to cover all use cases
and error conditions.
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
c6b999f178 ostree: rename CommitSource to CommitSpec and add Ref
The CommitSource was used to specify the source URL and checksum of a
commit for use in manifest sources.  Renaming to CommitSpec and adding a
Ref parameter generalises the type so that we can use it to specify
commits in various situations.  This is building towards separating when
ostree parameters are used for fetching a commit, fetching a parent
commit, and building one.

The CommitSpec is (very roughly) analogous to the rpmmd.PackageSpec.
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
938bc7bafd ostree: small docstring clarification 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
6bd15c19a3 manifest: use size from partition table for efiboot image 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
3ee5622ad7 manifest: fix typos and docstrings for OS pipeline
Fix the NewOS() docstring to mention only the function args.
2022-10-11 10:00:22 +02:00
Ondřej Budai
5bda62fff9 cloudapi: add iot-installer
This was forgotten in previous commits that fixed this image type.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-10-05 10:29:05 +02:00
Brian C. Lane
d9cfbea399 weldr: Add test for blueprint with empty version commit message 2022-09-30 17:42:07 +02:00
Brian C. Lane
b209bcec55 fedora: blueprint must have a name 2022-09-30 17:42:07 +02:00
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