Commit graph

1960 commits

Author SHA1 Message Date
Jozef Mikovic
a9e8ea2a21 distro/rhel90: add RHEL9 support
osbuild-composer can now build rhel 9.0 images.
Added support is limited to qcow2 image type.
2021-03-26 14:05:20 +00:00
Tomas Hozza
4a47ad36af Cloud API: fix image_status.status value for running compose
Previously, the Cloud API endpoint `/v1/compose/{id}` return value's
`image_status.status` for a running worker job was "running", which didn't
comply with the Cloud API specification. Equivalents allowed by the API
specification are "building", "uploading" or "registering".

As a result, the Image Builder API also does not comply in this regard
to its specification, because it currently just copies the status value
string returned by osbuild-composer.

Define the `image_status.status` as a reusable type in the Cloud API
specification. This forces openapi to generate an explicit type for it,
which can be then explicitly used in the code, instead of plain strings.

Return "building", instead of "running"  for running compose.

Modify api integration test to check for all valid `image_status.status`
values for a compose.

Add News entry explaining this change.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-26 11:59:07 +01:00
Ondřej Budai
6804fe456b osbuild1: make the conversion from v2 result stable
A result from manifest v2 contains logs from pipelines. The individual
pipelines are stored as an object, thus they have no order. Well, at least
in Go, because it doesn't guarantee one when parsing maps, see:

https://github.com/golang/go/issues/27179

Unfortunately, this makes the Result.fromV2 method return unpredictable
results because the pipeline results are processed in basically a random
order.

This caused the TestUnmarshalV2Failure test (result_test.go:124) to randomly
fail because it expects the ordering to be stable. I decided to fix this by
ordering the pipeline results by their name. When this fix is applied, the
output from Result.fromV2 is well-defined.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-25 11:14:46 +01:00
Ondřej Budai
9eb2268ffe test/nightly: fix the repository json
Trailing commas are a big no-no for json.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-23 09:25:20 +00:00
Aleksandar Todorov
c2dc9d65fb tests: Enable RT repository for nightly test jobs 2021-03-22 15:12:23 +01:00
Ondřej Budai
334f421927 test/cli: add a sanity check for Weldr logs
To prevent the issue fixed by the previous commit.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-19 18:50:31 +01:00
Ondřej Budai
ae2e549dd4 osbuild1/result: fix conversion of v1 result
Detecting if a result is in the v1 format using DisallowUnknownFields was
clever. However, the format of v1 result changed in the worst way at some
point in the past: A field (id) got added. Therefore, this was an unknown
field to osbuild-composer and it fall back to decoding the input as a v2
result which led to empty logs.

This commit reimplements the result schema check: The new format always
have a top-level type field, whereas the old format doesn't have it. The
new implementation uses this fact to distinguish between v1 and v2 format
of a result.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-19 18:50:31 +01:00
Ondřej Budai
ea8d080c8a osbuild1/result: fix conversion of success field from v2
When a stage is successful in a manifest v2, the success field is omitted from
the result. In other words, the default value of the success field is true
which is against the default value of boolean in Go. This commit implements
a workaround.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-19 18:50:31 +01:00
Martin Sehnoutka
9ba6dcec4e osbuild-worker: log unknown upload type
Make the target error a bit more useful by sending the name of unknown
upload target.
2021-03-19 15:59:57 +01:00
Martin Sehnoutka
dfa227e82f osbuild-worker: s|errored|failed| because error is a noun
Fix grammar issue.
2021-03-19 15:59:57 +01:00
Martin Sehnoutka
34d165be6c osbuild-worker: unify logging statements
The code previously used both fmt.Printf and log.Printf. Simplify this
by using log.Printf everywhere.
2021-03-19 15:59:57 +01:00
Martin Sehnoutka
a3d80cc924 osbuild-worker: simplify jobimpl osbuild code
The previous version constructed multiple temporary variables and then
create job result from them. This was needed because we had multiple
upload targets but now that we have only one, this is only fragile
version of what can be done in a simplified way.

This PR removes the temporary variables and assigns errors and success
states right after the upload or build has finished.
2021-03-19 15:59:57 +01:00
Martin Sehnoutka
3f9f8c7487 osbuild-worker: drop support for multiple upload targets
Multiple upload targets are not supported by osbuild-composer any more.
Dropping support for this in worker therefore doesn't change anything
from the user's perspective, but it allows us to simplify the code a
bit.

Replace calls to "continue" with "return nil" because the job finished
correctly even though it failed to perform the task. But the failure was
reported to osbuild-composer for further processing so there is no need
to duplicate and report the same error in worker process
2021-03-19 15:59:57 +01:00
Martin Sehnoutka
086a9270b4 osbuild-worker: drop support for local and koji target
Drop support for LocalTarget, this has not been used in a long time,
and we don't really need to stay compatible across many releases
(just as long as we don't get problems with having to deploy in
lock-step), at least not yet.

Also drop support for KojiTarget, this has been replaced by the
osbuild-koji job type.
2021-03-19 15:59:57 +01:00
Martin Sehnoutka
87942865ba osbuild-worker: refactor reporting the job status to deref
The previous implementation exited before reporting back to the worker
API in few branches. This left the compose status in RUNNING state even
though the worker did not work of the job any more. Refactoring the
API call into the `deref` part makes sure it gets called every time.

This commit only moves bits of the code around so that the status gets
back to osbuild-composer, but it still doesn't contain any useful
information in case osbuild fails etc. This will be introduced in
subsequent commits.
2021-03-19 15:59:57 +01:00
Aleksandar Todorov
aa21b57daf tests: install awscli from EPEL. Fix #1037 2021-03-19 11:21:50 +01:00
Achilleas Koutsou
7066b02bf7 ostree-ng.sh: use non-default ostree ref
Run tests with user-specified ostree ref.
The ref needs to be specified in the container build as well (without a
URL) to be used for the commit that will be served to the installer.

The same variable/ref is also used to retrieve the $UPGRADE_HASH for the
final OS test.
2021-03-18 20:06:25 +00:00
Achilleas Koutsou
f4ec9d8d91 distro/rhel84: use user ref for commits
Bug fix for changes introduced in #1244.

The new image types, rhel-edge-container and rhel-edge-installer, would
ignore the user-supplied ostree ref and use the default everywhere.

The default should only be used when a ref is not specified, which the
weldr API takes care of before calling the Manifest() method.
2021-03-18 20:06:25 +00:00
Ondřej Budai
dbee4cdbd1 tools/generate-test-cases: fix missing comma
This slipped in aeddf7e501 and
survived 28aaa129ff, let's fix it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-18 12:31:01 +01:00
Achilleas Koutsou
65ca29badb test/repositories/rhel-84: change to rh dev snapshots
For the new features, we need a very recent release of Anaconda.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
b9e98a65a3 Schutzfile: pin osbuild for rhel-8.4
Pinning to v27: Released, but not available in repo snapshots yet.

Contains fix for home directories when using ostree:
https://github.com/osbuild/osbuild/pull/613
2021-03-17 18:12:17 +00:00
Xiaofeng Wang
20af9a7258 test: Remove user SSH key work around
It's been fixed already by commit 1b0e9e3
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
b843c77c8c rhel84: add a first boot stage for user SSH key
User home directories don't survive the rpm-ostree stage.  They are
converted to systemd-tmpfiles via rpm-ostree post-process, but the
contents are left behind, so any keys we add to the authorized_keys file
will be gone.

This stage sets up a first-boot service that writes the user's public
key to the file in the home directory during the first system boot.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
1aa0dc28a9 rhel84: fix ostree URL in kickstart
In the Anaconda pipeline, the kickstart stage should fetch the commit
we're embedding.  It was mistakenly trying to fetch from the URL used to
build the image instead.
2021-03-17 18:12:17 +00:00
Xiaofeng Wang
4844f4bc7a test: Fix ssh public key issue
The public key should be osbuild-composer CI's key, not my local
test one
2021-03-17 18:12:17 +00:00
Tom Gundersen
955585072d ostree-ng.sh: set VERSION-ID and ID variables
We only support one combination for now, but let's stay compatible with the old tests.

This fixes the places where these variables are still used.
2021-03-17 18:12:17 +00:00
Xiaofeng Wang
5445acb0cc test: Update ostree-ng to support container and installer tests
The ostree-ng will only be run on RHEL 8.4 because
rhel-edge-container and rhel-edge-installer image type are
supported by RHEL 8.4 only
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
f8b3b3f7e2 rhel84,osbuild2: add system ID to ISO
New stage option added in osbuild
https://github.com/osbuild/osbuild/pull/611

System ID is used by osinfo to identify the RHEL boot ISOs, where the
system ID is "LINUX".
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
8c92553623 docs/news: update news item to mention both image types 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
ae4a1384e3 Schutzfile: pin osbuild for rhel-8.4
The new rhel-edge-installer requires unreleased fixes:
https://github.com/osbuild/osbuild/pull/610
https://github.com/osbuild/osbuild/pull/611
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
bacba210b0 rhel84: new image type: rhel-edge-installer
New image type that generates a Boot ISO.  The ISO contains a RHEL Edge
commit and an installer.  On Boot, it sets up a new RHEL Edge system
with the commit.

The RHEL Edge commit (ostree commit) is downloaded during build from a
URL that should be supplied with the compose request.  The commit's hash
and URL need to be added to the Sources list in the Manifest.

Unlike other types, the new image type defines its own "build" package
set that is added to the distro and arch build package lists.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
2edb057f3b distro: add URL to OSTreeImageOptions
We need to add the URL to the manifest as an ostree source repo so that
osbuild can pull the commit to embed it in the boot ISO for the new
rhel-edge-installer image type.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
33cebcc8fc osbuild2: port tar assembler to new stage 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
bec194dfff osbuild2: add support for new osbuild stages
- org.osbuild.anaconda
    Configures Anaconda.  For now, only enabling kickstart modules is
    supported.

- org.osbuild.buildstamp
    Creates a buildstamp file, which is required by Anaconda.

- org.osbuild.kickstart
    Creates a kickstart file.

- org.osbuild.lorax-script
    Uses lorax template helpers to execute a template.

- org.osbuild.bootiso
    Prepares a bootable file system tree suitable for writing on an ISO
    file system

- org.osbuild.discinfo
    Creates a .discinfo file, used by the Anaconda installer.

- org.osbuild.xorrisofs
    Uses the `xorrisofs` command line utility to an ISO.

- org.osbuild.implantisomd5
    Uses the `implantisomd5` command to implant MD5 checksums into an
    ISO.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
011559f785 osbuild2: add SavedEntry to Grub2StageOptions
Added in osbuild1 already.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
f107241ee2 obsuild2: support additional layers in oci-archive
The org.osbuild.oci-archive stage now supports an arbitrary number of
layers on top of the Base layer.  The keys for these layers follow the
pattern "layer.N" (N = 1, 2, 3, ...).

We use a custom marshaller and unmarshaller for the
OCIArchiveStageInputs to handle this.  The unmarshaller also validates
the layer keys to match the pattern in the schema.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
dc5e46139a osbuild2: new dracut stage to re-create initrd 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
3618611d6f Schutzfile: pin osbuild for rhel-8.4
We need to test the PR before a new osbuild is released.  Pinning to
current `main`.

In particular, we need to test against
https://github.com/osbuild/osbuild/pull/600
2021-03-17 18:12:17 +00:00
Xiaofeng Wang
e4419ed752 test: Update ostree-ng.sh to work with rhel-edge-container test
rhel-edge-container is only supported by RHEL 8.4, so the test is
for RHEL 8.4 only
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
2e58dfa61b distro/rhel84: reuse edge package lists for new types
The payloads for these image types should be identical, so no need to
redefine them.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
7b02d43139 osbuild-image-tests: call osbuild with export option
Call osbuild with the export option.  For now the only valid export
value is "assembler".

Run all exported images through testImage.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
164faa7503 osbuild{1,2}: new stages in unmarshal method
Recently added stages org.osbuild.sysconfig and
org.osbuild.kernel-cmdline were missing from the Manifest unmarshal
method causing it to fail when trying to unmarshal manifests that
contained them.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
ce963004e0 docs/news: describe osbuild v2 and new image-type 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
12d4f82428 osbuild-worker: handle 0 and > 1 exports in job
If exports is undefined in request, add the default "assembler" for the
old image types.

If more than 1 export is requested, fail with an error.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
f317b0a3d9 test/data: test cases for rhel-edge-container 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
bc8ac681b6 osbuild-pipeline: add ostree.ref image option
Use default ostree ref for each image type when generating pipelines.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
e5abd5e5a6 cli-tests: print stderr when cli test fails
When shelling out for a CLI test the error returned from the Start()
command prints the exit code which is not very informative.  Capturing
and printing stderr is a lot more useful.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
28aaa129ff generate-test-cases: export flag for osbuild call
osbuild requires the export flag otherwise it wont produce an artifact.
For the older manifest format (v1), the export value is always
"assembler".  For v2 manifests, it is the name of the last pipeline.

If an unknown version number is read the script now fails.  This should
help catch manifest changes that may affect test case generation in the
future.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
0f5936e9fe osbuild1/source: minor typo fix 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
007d52f171 osbuild1/result: read v2 output and convert to v1
Log output from osbuild has a very different format when using the
new schema.  The osbuild1.Result object now supports unmarshalling the
new format and adapting it to the old format.

The most important field to set is the Success field to signal whether
the build succeeded.

Secondarily, it also copies over the output from each stage in order to
provide build job log output through the weldr API.
Since the new format contains multiple pipelines with multiple stages
each, the stages are flattened to fit the old format.  A unique name for
each stage is created by prepending the name of the pipeline to its
index in the pipeline and its type.
2021-03-17 18:12:17 +00:00