Commit graph

4330 commits

Author SHA1 Message Date
Chloe Kaubisch
765e93bfc8 cloudapi: get specific error from openapi
Error handling is structured in such a way that typically, a ServiceCodeError is passed
through the echo HTTP error, in reference to internally defined errors. We want to be able
to obtain and return specific external errors, for example during validation from openapi3.
Add a 'details' field to the serviceError struct, to contain extra / externally defined
information. Modify HTTPErrorHandler to anticipate either a string or a ServiceErrorCode
from echo, and respond accordingly. Edit the affected tests to expect the appropriate response.
2022-06-28 10:02:55 +02:00
Achilleas Koutsou
d59d870574 dnf-json: fix depsolve error handling
When a DepsolveError exception occurs, the error message would print the
packages in the request.  When the request arguments changed, the error
message handling wasn't updated and would fail to produce the correct
error message.

Compile a list of packages from all transactions and print them in the
error message as a comma-separated list.
2022-06-27 20:41:34 +02:00
Tom Gundersen
be2195b235 pipeline: add a bit more documentation
Make sure that each of the types have at least a bit of documentation.
2022-06-27 19:11:26 +01:00
Tom Gundersen
4556312d22 pipeline: split qcow2 into format specific pipelines
Stages are procedural and named after the tool they wrap, but pipelines are declarative and should
be named after the kind of artefact they produce.

This splits the qemu (the tool) pipeline into qcow2, vmdk, and vpc (the formats) pipelines. In theory
we may have wanted to implemented through some shared helpers, but for now it seems trivial
enough that it is not worth it.
2022-06-27 19:11:26 +01:00
Tom Gundersen
1fa92f9091 pipeline: distinguish between optional and mandatory properties
The ideal is that the constructor takes mandatory properties as arguments, and fields in the struct
are all optional.

This clarifies that across the pipelines (or leaves TODOs where work remains), and where possible
makes fields optional by providing a valid default value.
2022-06-27 19:11:26 +01:00
Tom Gundersen
c001af63ec pipeline: further cleanups
This adds more documentation and makes more properties implicitly inherited rather than
repeated. This makes for less boilerplate, and gives us fewer things to keep in sync.
2022-06-27 19:11:26 +01:00
Tom Gundersen
e5ef7933ac pipeline: drop stage_options.go
This was barely used. Making it explicit seemed more readable.
2022-06-27 19:11:26 +01:00
Tom Gundersen
f60092033b pipelines: make OSPipeline own the PartitionTable
The OSPipeline might need to know what disk layout it will be put onto, enforce this by making
the PartitionTable a property of the OSPipeline, and require child pipelines to query it when needed.
2022-06-27 19:11:26 +01:00
Tom Gundersen
ae34513d18 pipeline: move package to top level
The pipeline package is exists conceptually between the distro and the osbuild packages, so move
it to the top level rather than as a child of distro.

No functional change.
2022-06-27 19:11:26 +01:00
Tom Gundersen
e024ceb138 pipelines: cleanups
This is a collection of minor cleanups:
 - Start documenting the API
 - Enforce dependent pipelines have the correct type where necessary
 - Use data from dependent pipelines where possible
 - Start enforcing required fields
 - Move logic into the pipeline implementation where we can
2022-06-27 19:11:26 +01:00
Tom Gundersen
040a4ef6a1 pipelines: add Fedora IoT installer pipelines 2022-06-27 19:11:26 +01:00
Tom Gundersen
284eb9af59 distro/fedora: drop dead code 2022-06-27 19:11:26 +01:00
Tom Gundersen
0f015801d7 pipelines: add Fedora IoT commit and container pipelines 2022-06-27 19:11:26 +01:00
Tom Gundersen
1243f84cb0 pipelines: add fedora liveimg and qemu pipelines 2022-06-27 19:11:26 +01:00
Tom Gundersen
562a5b1127 pipelines: add fedora OS pipeline
This pulls out the OS pipeline, without changing the parameters. The dependency
between the OS pipeline and build pipeline, is now explicit, rather than by name.
2022-06-27 19:11:26 +01:00
Tom Gundersen
b6d6626a5d pipelines: introduce pipeline abstractions
Create a new package to encapsulate pipelines. This introduces only the build
pipeline and uses it in fedora.

No functional change.
2022-06-27 19:11:26 +01:00
Tom Gundersen
b8815aab4c distro/fedora: avoid double import
Fix typo. No functional chnage.
2022-06-27 19:11:26 +01:00
Ygal Blum
534625fa38 Fedora - Use vendor instead of rpm dependencies
RPM Spec
--------
Remove all Go dependecies
Add Start and End marker comments for bundling information
Add '-k' to goprep to preserve the vendor directory

tools
-----
Add script to update the RPM spec file to generate the indication lines
based on vendor/modules.txt

Packit
------
Run the new script as a post-upstream-clone hook

Makefile
--------
Run the new script on the generated spec file before generating the RPM

mockbuild.sh
------------
Run the new script before creating the RPM
2022-06-23 18:02:09 +02:00
Jakub Rusz
8fef39c4cf rpmbuild: add fedora-36 2022-06-23 12:30:20 +02:00
Achilleas Koutsou
365e1d109c distro/rhel7: remove vhd image type
1. Broken: specifies packages that aren't available in the repositories
   (langpacks-en and dhcp-client).
2. Not needed.
2022-06-23 10:12:35 +02:00
Christian Kellner
292ffd59a0 cmd/osbuild-upload-gcp: fix typo in skip-import's help string 2022-06-22 12:37:34 +02:00
Jakub Rusz
0201b0bff9 tests: Update compose version in Upgrade test 2022-06-21 10:40:58 +02:00
Jakub Rusz
2eee0632d6 manifests: regenerate rhel-91-gce-boot
We don't want to do gpg check for the google repositories.
2022-06-21 10:40:58 +02:00
Jakub Rusz
70688173bb tests: update RHEL version in unsupported tests 2022-06-21 10:40:58 +02:00
Jakub Rusz
81c66b5128 CI: move centos out of RHEL runners
We have this lits of separate RHEL runners only to build test rpms
during nightly pipelines.
2022-06-21 10:40:58 +02:00
Jakub Rusz
eb78fcd85e tests/koji: build latest RHEL when running on RHEL
Based on
aff680542d
this test is supposed to always build the latest available compose.
2022-06-21 10:40:58 +02:00
Jakub Rusz
5fcf0b1d53 tests/ostree: Update to support new RHEL nightlies 2022-06-21 10:40:58 +02:00
Jakub Rusz
1829ff24ea Update terraform SHA 2022-06-21 10:40:58 +02:00
Jakub Rusz
d1c6b46ac3 Schutzfile: update snapshots and osbuild commits
New osbuild commmit SHA and newer rpmrepo snapshots
osbuild commit: stages/mkfs.fat: pass -I command line option
2022-06-21 10:40:58 +02:00
Jakub Rusz
d87c60857c mockbuild: update mockbuild script after RHEL-9 GA
Removing rhel-9 templates as they are shipped upstream already and
making necessary modifications to mockbuild.sh
2022-06-21 10:40:58 +02:00
Alexander Todorov
0fd77f4594 Update osbuild commit 2022-06-21 10:40:58 +02:00
Alexander Todorov
0d3ef8817a Update repositories in repo-*.json files 2022-06-21 10:40:58 +02:00
Alexander Todorov
b82895b52a Define 8.7 & 9.1 nightly repos in Schutzfile 2022-06-21 10:40:58 +02:00
Alexander Todorov
8c03162867 COMPOSER-1576: Switch to latest RHEL versions for testing 2022-06-21 10:40:58 +02:00
Achilleas Koutsou
e8d6dee9ac CI: run the new test script on gitlab
We only need one runner and it should use the internal network for
access to all repositories.

Set a rule so it doesn't run on 'main' (makes no sense).

Set git depth to 500:
We need a long history in order to find the merge-base between the PR
and 'main'.  It's unclear whether there's a straightforward way to find
the depth of the PR to limit the clone depth accurately.  500 should be
enough for any PR (I'd hate to see a PR that makes this statement
false).
2022-06-21 09:50:45 +02:00
Achilleas Koutsou
7076f9b8dc test: new script that detects changes in manifests in a PR
The script runs the gen-manifests command first on the PR head and then
on the merge-base with the PR's base branch (typically 'main') and
checks for any differences.  It creates a review comment on the PR on
GitHub if any changes are detected.

The message is posted as a simple COMMENT type review to inform the
author and reviewers that changes exist.

The script doesn't fail if there's a diff.  CI shouldn't fail if changes
are detected since they can be intentional.  The job fails if something
goes wrong with the script execution (manifest generation, comment
posting, etc).

The script exits immediately if not run from a PR.

The gen-manifests run is silenced with `> /dev/null`.  In the future,
this should be handled by flags to the command itself to control the
output format noisiness.

The gen-manifests command is run 50 workers.  Testing with 100 seemed to
make the execution stall, likely because of the resources on the worker.
We can experiment with this value more in the future.
2022-06-21 09:50:45 +02:00
Christian Kellner
c38fcb128c distro/rhel7: add support for azure images
Add support for building Azure images, including RHUI based ones for
the private market place.
2022-06-21 00:06:26 +02:00
Christian Kellner
06e05df620 distro: add support for building a rhel 7 (qcow2)
Based on the RHEL 8.6 pipelines, needs a special buildroot with two
extra packages: python3-iniparse and python3-PyYAML.
Only x86_64 support for now.
2022-06-21 00:06:26 +02:00
Christian Kellner
13ce6140b9 distro: add YumConfig to ImageConfig
Not adding the actual option to any existing pipelines, since this is
only going to be relevant for rhel7.
2022-06-21 00:06:26 +02:00
Christian Kellner
42038ad47b osbuild2: support for the new vpc options in the qemu stage
Recently osbuild exposed the low level qemu options for the VPC
format. Add support for the `force_size` option.
2022-06-21 00:06:26 +02:00
Christian Kellner
5082c36ca5 osbuild2: add new Grub2LegacyStage for org.osbuild.grub2.legacy
Expose osbuild's `org.osbuild.grub2.legacy` stage.
2022-06-21 00:06:26 +02:00
Christian Kellner
75d7bbaaa3 osbuild2: optionally use sgdisk for partitioning
Add a new option to `GenImagePrepareStages`, which is used by all
modern pipelines for partitioning, to optionally use the `sgdisk`
partitioning tool via `org.osbuild.sgdisk`.
2022-06-21 00:06:26 +02:00
Christian Kellner
4b4e8ca810 osbuild2: add new SgdiskStage for org.osbuild.sgdisk
New partitioning stage that uses `sgdisk(8)` via `org.osbuild.sgdisk`.
2022-06-21 00:06:26 +02:00
Christian Kellner
074973e03d osbuild2: rename Partition to SfdiskPartition
Properly namespace the partition stage options for the Sfdisk stage.
2022-06-21 00:06:26 +02:00
Christian Kellner
4d9215ffb0 osbuild-pipeline: add support package sets in repo definitions
THe `rpmmd.RepoConfig` configuration supports setting "package sets"
for each repository, which allows the associate the individual repos
to specific package sets. Add a new `package_set` option to the
repo configuration of the compose request so that this feature can
be used.
2022-06-21 00:06:26 +02:00
zwtop
5c79d4e98c docker-compose: fix osbuild-worker unable load libcrypt.so.1
Signed-off-by: zwtop <wang.zhan@smartx.com>
2022-06-18 11:39:10 +01:00
Tomas Hozza
bdf009f800 UploadJobArtifact(): return 400 if not accepting artifacts
The worker server API handler `UploadJobArtifact()` was previously
silently discarding artifacts uploaded by the worker, if the server was
configured to not accept artifacts.

Change the behavior to return HTTP error "Bad Request" (`400`) to the
worker, in case it tries to upload artifact to the server, but the
server is configured to not accept any artifacts.

Add a new unit test testing the new behavior and adjust existing unit
tests, which were relying on the artifact being previously silently
discarded.
2022-06-17 17:37:15 +02:00
Tomas Hozza
fd82174469 worker/osbuild: consolidate Koji target options values meaning
When the Koji target support was added to the osbuild job, based on the
osbuild-koji job, the meaning of target option values got messed up.

The side effect of the issue is that when Koji composes are
submitted via Cloud API the resulting image is currently always uploaded
back to the worker server.

`OsBuildKoji` job
-----------------
- `OSBuildKojiJob.ImageName` is set to the filename of the image as
  exported by osbuild.
- `OSBuildKojiJob.KojiFilename` is set to the desired filename which
  should be used when uploading the image to Koji.

`OsBuild` job + `KojiTargetOptions` before
------------------------------------------
- `OSBuildJob.ImageName` is set to the filename of the image as exported
  by osbuild. This is done only by the Cloud API code for Koji composes.
  Cloud API does not set this for regular composes and any other target.
  The variable is set in common case only by Weldr API code with the
  same meaning and it is used by the `OsBuild` job implementation as an
  indication that the image should be uploaded back to the worker server.
- `Target.ImageName` is not set at all. Other targets use it for the
  desired filename which should be used when uploading the image to the
  target environment.
- `KojiTargetOptions.Filename` is set to the desired filename which
  should be used when uploading the image to Koji. All other target
  types use `Filename` variable in their options for the filename of the
  image as exported by osbuild.

`OsBuild` job + `KojiTargetOptions` after
-----------------------------------------
- `OSBuildJob.ImageName` is still set to the filename of the image as
  exported by osbuild. This is kept for a backward compatibility of new
  composer with older workers.
- `Target.ImageName` is set to the desired filename which should be used
  when uploading the image to Koji.
- `KojiTargetOptions.Filename` is set to the filename of the image as
  exported by osbuild.

This change is backward incompatible, meaning that old worker won't be
able to handle Koji compose requests submitted via Cloud API using a new
composer and also a new worker won't be able to handle Koji compose
requests submitted by a new composer. This is intentional, because after
discussion with Ondrej Budai, the Cloud API Koji integration is
currently not used anywhere in production.
2022-06-17 17:37:15 +02:00
Achilleas Koutsou
1ae0a5f469 CI: run the new regression test (insecure-repo)
Run on 9.0 GA only.  Running it on more than one distro is unnecessary.
2022-06-15 20:13:47 +02:00
Achilleas Koutsou
aace1c9224 test: add new regression test for insecure downlods
Creates a dummy package and a web server with TLS and a self-signed
certificate and builds an image from the repository with `check_ssl`
disabled.
2022-06-15 20:13:47 +02:00