Commit graph

754 commits

Author SHA1 Message Date
Achilleas Koutsou
8f69088af1 distro: remove architecture names and use platform enum
Removing the dependence of the manifest package on the distro package to
import manifest into distro.
Wherever arch names are needed, we use the enums from the platform
package instead.
2023-05-31 16:40:07 +02:00
Gianluca Zuccarelli
ce299dfa0e internal/rpmmd: change ignoressl to pointer
Change the `IgnoreSSL` field in `rpmmd.RepoConfig`
to a pointer. This will be later used to configure
the `SSLVerify` field in the yum repo stage.
2023-05-31 16:24:36 +02:00
Sanne Raymaekers
8a8607cdf6 internal/vmware: add support for the GOVC_FOLDER option
When importing the ova it also creates a VM, and users don't always have
permission to register in the default folder.
2023-05-25 10:14:32 +02:00
Sanne Raymaekers
967306bc47 internal/upload: add import.ova support to vmware 2023-05-25 10:14:32 +02:00
dependabot[bot]
60e55b5ed3 build(deps): bump cloud.google.com/go/compute from 1.10.0 to 1.19.3
Bumps [cloud.google.com/go/compute](https://github.com/googleapis/google-cloud-go) from 1.10.0 to 1.19.3.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/documentai/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/kms/v1.10.0...compute/v1.19.3)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/compute
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Migrated to the new version by following
https://github.com/googleapis/google-cloud-go/blob/main/migration.md

Co-authored-by: Tomáš Hozza <thozza@redhat.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 11:51:42 +02:00
Tomáš Hozza
403b1e4692 AWS: extend target options with the AMI boot mode
Add an optional `BootMode` field to the AWS target options.
This allows to signal to worker the intended boot mode to use when
registering the AMI in AWS. If not specified, the default behavior is
preserved, specifically that the boot mode will be determined by the
default boot mode of the instance provisioned from the AMI.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-19 13:24:39 +02:00
Tomáš Hozza
e13f0a1ae2 AWS: allow specifying the AMI boot mode when registering the image
When the AMI is being registered from a snapshot, the caller can
optionally specify the boot mode of the AMI. If no boot mode is
specified, then the default behavior is to use the boot type of the
instance that is launched from the AMI.

The default behavior (no boot type specified) is preserved after this
change.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-19 13:24:39 +02:00
Gianluca Zuccarelli
3b6fddb14a internal/rpmmd: add missing fields to RepoConfig
Further align the RepoConfig object to the dnf
spec and add missing fields.
2023-04-21 17:40:00 +02:00
Gianluca Zuccarelli
d44703cdc8 rpmmd/repository: repoconfig pointers
Convert some of the fields in the `RepoConfig` struct
to pointers. Since `RepoConfig` will be used to convert
custom repositories to an array of `osbuild.YumRepository`,
we need to ensure that fields that are not set explicitly
are not saved to the `/etc/yum.repos.d` repository files.
2023-04-21 17:40:00 +02:00
Gianluca Zuccarelli
4d42808b6a internal/rpmmd: RepoConfig baseurl change
Update the internal RepoConfig object to
accept a slice of baseurls rather than a
single field. This change was needed to
align RepoConfig with the dnf spec [1].

Additionally, this change adds custom json
marshal and unmarshal functions to ensure
backwards compatibility with older workers.
Add json tags to the internal rpmmd config
since this is serialized in dnfjson.
Add unit tests to check the serialization
is okay.

[1] See dnf.config
2023-04-21 17:40:00 +02:00
Achilleas Koutsou
a7dd8ff94f container: add ListDigest to the spec
Add the ListDigest to the container Spec struct and all its copies so we
can store list digests when they are available and pass them on to the
appropriate osbuild stages, sources, and inputs.

Copy the value whenever a spec is moved to a different representation.
2023-04-17 18:30:41 +02:00
Irene Diez
47bb682221 cmd: handle generated warnings during Manifest initialization
Signed-off-by: Irene Diez <idiez@redhat.com>
2023-03-31 14:14:57 +02:00
Achilleas Koutsou
81d6f526d0 config: don't show azure-eap7-rhui in weldr
The azure-eap7-rhui image type should only be available for internal
builds (for now).
2023-03-30 18:40:12 +02:00
Brian C. Lane
f731ab53d0 dnfjson: Cleanup old distro cache dirs
This adds a function, CleanupOldCacheDirs, that checks the dirs under
/var/cache/osbuild-composer/rpmmd/ and removes files and directories
that don't match the current list of supported distros.

This will clean up the cache from old releases as the are retired, and
will also cleanup the old top level cache directory structure after an
upgrade.

NOTE: This function does not return errors, any real problems it
encounters will also be caught by the cache initialization code and
handled there.
2023-03-23 11:26:40 +01:00
Brian C. Lane
3481e1d3ba Change the rpmmd cache directory structure to include the distro name
This causes dnf-json to use separate caches, allowing them to run in
parallel, with one lock per distribution. Multiple depsolves with the
same distribution in the blueprint will continue to be serial.
2023-03-23 11:26:40 +01:00
Simon de Vlieger
39879a9f60 disk: add RequiredSizes to ImageOptions
These RequiredSizes are a map that is passed on to the partition table
logic which had hardcoded defaults. This makes it possible to define
either no RequiredSizes (`nil`) or empty RequiredSizes which means no
further constraint checks or partition resizes will be done.
2023-03-20 11:04:14 +01:00
Gianluca Zuccarelli
4fee181fec worker: add file resolve job
Implement a file resolution job which fetches
the contents of a remote file.
2023-03-16 09:55:39 +00:00
Brian C. Lane
b1c2dbdfc6 Remove old build tag comments
Go is transitioning from the old '// +build' form to '//go:build', this
removes all uses of the old form, adding the new one where needed.

See https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md
2023-03-07 09:22:23 -08:00
Brian C. Lane
7a4bb863dd Update deprecated io/ioutil functions
ioutil has been deprecated since go 1.16, this fixes all of the
deprecated functions we are using:

ioutil.ReadFile -> os.ReadFile
ioutil.ReadAll -> io.ReadAll
ioutil.WriteFile -> os.WriteFile
ioutil.TempFile -> os.CreateTemp
ioutil.TempDir -> os.MkdirTemp

All of the above are a simple name change, the function arguments and
results are exactly the same as before.

ioutil.ReadDir -> os.ReadDir

now returns a os.DirEntry but the IsDir and Name functions work the
same. The difference is that the FileInfo must be retrieved with the
Info() function which can also return an error.

These were identified by running:
golangci-lint run --build-tags=integration ./...
2023-03-07 09:22:23 -08:00
Tomáš Hozza
0e4a5b34b2 worker: allow configuring number of upload threads for Azure
The default number of threads (16) is OK for general use case. However,
we are being asked by RH IT to lower the number of threads when
uploading the image to Azure using proxy server.

Make the number of threads configurable in the worker configuration and
default to the currently used value if it is not provided.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-03-03 18:15:53 +01:00
Achilleas Koutsou
b8fc241755 gen-manifests: copy whole repo config when generating tests
The bug wasn't caught because the PackageSets field of the repository
wasn't being copied after parsing the compose request for the test
manifest.

This should now catch future occurrences of this bug.
2023-02-23 16:22:42 +01:00
Ondřej Budai
9633dce3bb osbuild-pipeline: add support for RHSM when defining repos
I use this tool quite a lot and I often want to use the CDN content, so
I would very much appreciate RHSM support. :)

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-02-06 10:02:04 +01:00
Achilleas Koutsou
d877b7419e osbuild-dnf-json-tests: remove distro loop
We only test one distro, CentOS 9, so there's no need to loop and spawn
a new t.Run().
2023-02-02 19:01:20 +01:00
Brian C. Lane
d12447408b Change RepoConfig.GPGKey to an array of key strings
DNF supports more than one GPG key. It is possible that one may be used for
signing packages, and another to sign the repository metadata. This
renamed GPGKey to GPGKeys internally. It does not change the on-disk
repository json format.
2023-02-01 10:27:58 +01:00
Brian C. Lane
a47375a10d Rename gpgkey_urls to gpgkeys
This has never been supported in osbuild-composer, so it is safe to
rename in preparation for adding repo metadata gpg signature checking.
2023-02-01 10:27:58 +01:00
Diaa Sami
081cc37973 osbuild-worker: Add log statements for Splunk dashboard 2023-01-27 12:02:12 +01:00
Diaa Sami
7a67e7b7e8 osbuild-worker: annotate log statements used by splunk
So that they are not changed by mistake
2023-01-26 11:34:20 +01:00
Sanne Raymaekers
2e3dd16220 osbuild-service-maintenance: clean up all regions
Since we started cloning images to different regions, the maintenance
script should clean up all of these regions.
2023-01-25 14:20:51 +01:00
Achilleas Koutsou
e4bb7f4f16 distro: remove packageSetChains from image type in RHEL 8 & 9
Image types no longer report their chains.  Instead, pipelines report
their packages and chains and blueprint packages are added to the
workload.

The distro.ImageType interface retains the PackageSetsChains() methods
for RHEL 7 until that is rewritten as well.

The osbuild-dnf-json-test doesn't use the PackageSetsChains() method
anymore.  Instead, since it only test the centos-8 qcow2 image, it
hardcodes the expected package set names.
2023-01-18 11:50:35 +01:00
Ondřej Budai
0359647a82 go.mod: update to Go 1.18
Fedora 35 support was dropped, so we can update to a newer Go.

Stable RHEL 8 and 9 and Fedora 36 ships Go 1.18, so let's switch to it.

"//go:build" directives are now apparently enforced by go fmt, so that's why
there were added.

Also, all the github actions were adjusted to use Go 1.18.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-01-09 14:03:18 +01:00
Sanne Raymaekers
6ca12a493d osbuild-worker: add dnf-json error reason to depsolve job error 2023-01-06 13:55:04 +01:00
Ondřej Budai
4bafe1ead9 remove Fedora 35 support
Fedora 35 is going EOL on Tue 2022-12-13. At the time of writing this commit
message, that's the next day. As we do releases on Wednesdays, the next
release will never find its way to F35 and thus, there's no point in keeping
support for it.

Let's delete everything that relates to Fedora 35. If there's something that
cannot be deleted (e.g. CI containers based on F35), let's upgrade it to F37.

TestCrossArchDepsolve now uses CentOS Stream 8 because RHEL 8.4 cannot read
F37 repository metadata. This is a similar issue to
https://bugzilla.redhat.com/show_bug.cgi?id=2004853 . Basically, newer
repositories can be only read by libmodulemd >= 2.11.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-01-06 11:34:50 +01:00
Sanne Raymaekers
369f237d89 gen-manifests: add ostree rhsm option 2022-12-12 13:42:52 +01:00
Ondřej Budai
972da81a91 worker: fix reporting the import error to composer
The result variable wasn't used at all, kojiFinalizeJobResult is what actually
reports the error.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-12-01 20:59:30 +01:00
Achilleas Koutsou
e3e71f01bf cmd/gen-manifests: add package-sets to repo config
Was missing the package sets key from the repo config struct, which
means that the option was being ignored and wasn't being serialised into
the test manifest either.
2022-11-30 10:04:16 +01:00
Achilleas Koutsou
de7bae02f3 cmd/gen-manifests: add RHSM fact to options
Add RHSM fact to image options when generating test manifests.
We add the value "test-manifest" to the API type to indicate it's a test
manifest.  This should never be registered and therefore shouldn't show
up in our data, but it's useful to detect changes and regressions in the
fact creation in the pipelines.
2022-11-30 10:04:16 +01:00
Achilleas Koutsou
1fc1178dea gen-manifests: save resolved containers
Store resolved container info in the test manifests so that they can be
read in the manifest unit test.
2022-11-28 17:20:49 +01:00
Achilleas Koutsou
bb75cc0947 gen-manifests: change default output directory
Change the default output directory to the one in the repo.
Originally it was set to a different directory to avoid overwriting the
manifests that had image-info, but those are long gone.
2022-11-28 17:20:49 +01:00
Achilleas Koutsou
e192cc4a18 gen-manifests: set default ref before resolving packages
Package collection reads options and customizations to determine which
build packages to pull, so we must set the default ref early if it's
needed.
2022-11-28 17:20:49 +01:00
Sanne Raymaekers
7ae79e7786 osbuild-worker: correctly pass ostree error details
Passing an error as details results in the details being empty after
marshaling. Pass the string formatted error instead.
2022-11-26 00:12:52 +00:00
Brian C. Lane
8c07d65fe0 distro: Add azure-sap-rhui image type to RHEL8 2022-11-18 16:53:22 +01:00
Sanne Raymaekers
28319f50d8 worker: log failures in ostree resolve job 2022-11-17 12:55:02 +01:00
Brian C. Lane
1096003598 store: Fix loading cross distro compose results
When the store is written to disk it simplifies the ImageBuild details
into a simple image type string. This works fine for composes that match
the host's distro but isn't enough detail to load composes made for
other distros, especially if the image type name isn't supported on the
host. This results in cross distro compose results being lost after a
reboot.

This fix uses the distro information from the compose's blueprint to
determine which distro the image type should be loaded from. It assumes
that the architecture matches the hosts' arch -- this is currently
always true but in the future if cross-arch builds are added it will
need to be addressed in a different way.

newComposeFromV0, newComposesFromV0, and newStoreFromV0 now take a
pointer to the full distro registry instead of an Arch, this allows them
to access the correct image types for the distro selected by the
blueprint. When loading the composes from disk the blueprint distro is
loaded from the registry before checking the image type string.

This means that we do not have to change the store version or on disk
format, the only thing changing is how it decides to populate the
ImageBuild when reloading the store.

A number of tests use a fake test distro using fake architecture names.
These tests have been adjusted to use a fake distro registry with
overridden host architecture that matches the fake one.
2022-11-03 08:39:22 +01:00
Tom Gundersen
626530818d worker/server: requeue unresponsive jobs
If a job is unresponsive the worker has most likely crashed or been shut
down and the in-progress job been lost.

Instead of failing these jobs, requeue them up to two times. Once a job is lost
a third time it fails. This avoids infinite loops.

This is implemented by extending FinishJob to RequeuOrFinish job. It takes a
max number of requeues as an argument, and if that is 0, it has the same
behavior as FinishJob used to have.

If the maximum number of requeues has not yet been reached, then the running
job is returned to pending state to be picked up again.
2022-11-02 15:26:00 +01:00
Sanne Raymaekers
e94ea7c995 internal/worker: add rhsm to ostree resolve job 2022-10-28 16:14:30 +02:00
Sanne Raymaekers
8fdd158799 cloudapi/v2: use the ostree resolve job to resolve ostree refs 2022-10-19 18:14:10 +02:00
Sanne Raymaekers
ebeb339f96 osbuild-worker: add ostree resolve job
This job resolves an ostree ref. Similar to the depsolve and container
resolve jobs, this should be a dependency of a manifest job.
2022-10-19 18:14:10 +02:00
Tomáš Hozza
dd36fce63c worker/gcp: return error if job doesn't specify object key
The object key is required in order to upload the image to GCP. Return
an error if it is not set.
2022-10-11 13:23:18 +02:00
Tomáš Hozza
b54b8fa3ab worker/gcp: allow setting Bucket in worker configuration
Extend the worker's configuration to allow setting GCP Bucket to use
when uploading images to GCP. The value from the configuration is used
only if not provided in the TargetOptions of the job.

In GCP, the region of the bucket does not limit importing of the image
to a particular region. So it is completely possible to use a single
Bucket to import images to any and all regions.

Return an error in case no bucket name was set in the job nor in the
worker configuration.
2022-10-11 13:23:18 +02:00
Tomáš Hozza
cc53f5423e worker/osbuild: use dedicated struct for GCP config internally
Previously, the internal `OSBuildJobImpl` structure defined only
`GCPCreds` member. This is not practical, once there will be more
than one GCP-related variable.

Define a new `GCPConfiguration` structure, move the credentials variable
into it and use it in `OSBuildJobImpl` instead.
2022-10-11 13:23:18 +02:00