Commit graph

3054 commits

Author SHA1 Message Date
Achilleas Koutsou
d0ba17cfe1 distro: move the checkOptions() call to the top of Manifest()
There's no need to do anything if the options fail to validate, so do
that first.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
65be6d65c2 manifest: fix repository collection in the os pipeline
In getPackageSetChain(), the workload repositories did not include the
ExtraBaseRepos.

In serialize(), when creating the rpm stage options (which collects
repository GPG keys), only the base repos were used, which is why we
previously had to merge repositories.  Instead of merging repositories
in the calling function in distro, we should keep them separated so that
we can easily distinguish which repositories are only meant for the
blueprint or workload when we need to.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
87233e12fb distro: attach payload repositories to workload package sets
The merging of payload repositories into the os pipeline had the
unwanted side effect of using the payload repos for the first depsolve
in the os chain when instead they should only be used for the second
(the depsolve for the blueprint or workload packages).  This wasn't an
issue before because we didn't do the merging in the PackageSets()
function, but now we rely on the Manifest() function for that
functionality instead.

Before the merging of the two functions, the PackageSets() function did
not merge repositories and the repository-to-package-set mapping was
maintained correctly, but the merging was needed in the Manifest()
function so that rpm stage options were generated for all repositories.
With this change, we are removing the merging so that the mapping is
maintained, and will fix the rpm stage option generation in the pipeline
generator.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
5ca4b4eb3f weldr: remove usage of ImageType.PackageSets()
Use the new manifest generation procedure in the Weldr API.

Updated test distro to include the same packages from the PackageSets()
method in the Manifest.Content.PackageSets.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
d5c4a0c31f distro: copy PackageSets() functionality into Manifest()
Copy the functionality of the ImageType.PackageSets() methods into
ImageType.Manifest() for each distro.

The Manifest() method now collects all package sets and repositories
from the blueprint and image type and after generating the Manifest
instance, calls the GetPackageSetChains() method to attach the computed
package sets to the Manifest before returning it.

The package sets in the call are now renamed to staticPackageSets to
differentiate from the dynamic (computed) package sets that are affected
by the manifest generation.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
1a38939abf distro: pass entire Blueprint to Manifest()
Pass the entire Blueprint to Manifest() instead of just the
Customizations.  The goal is to combine the functionality of the
ImageType.PackageSets() and ImageType.Manifest() methods into one call.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
30c5093fb5 manifest: document Pipeline interface
Docstrings for the Manifest.pipelines field and the Pipeline type
itself.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
8b46ead31b manifest: attach unresolved Content to Manifest struct
Add Content to the Manifest struct to represent unresolved packages,
container, and ostree commit specs that the caller should resolve before
serialising the manifest.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
12e8ab3ac6 Make Manifest() return manifest.Manifest
Return manifest.Manifest from the Manifest() function without
serializing.  The caller then has to call the manifest.Serialize()
function using the depsolved packages.

This moves towards changing the order of actions required to generate a
manifest.  With this change, the manifest creation and depsolving can be
done independently, but this still requires instantiating the manifest
object twice (InstantiateManifest() is called in PackageSets() and
Manifest()), which we don't want to have to do.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
db431a565d ostree: move OSTreeImageOptions to the ostree package
Move the ostree image options to the ostree package and rename the type
to ImageOptions (ostree.ImageOptions).
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
ffa1e1df17 rhsm: move FactsImageOptions to the rhsm/facts package
Move the FactsImageOptions from distro to the new rhsm/facts package.
At the same time define the values we use as an enum, including the
"test-manifest" value.
Though the values don't really matter, the test value is defined first
so it takes the 0 value, which feels nicer conceptually.

The field in the distro.ImageOptions is changed to be a pointer to allow
for nil values.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
f1557fc4e4 pipeline: expand interface to return source specs
Add two new methods to the interface for returning container source
specifications and ostree commit source specifications respectively.
These are analogous to the package set chains; they are unresolved
source specifications that can be used with the appropriate resolver to
create a full specification for a manifest.

Only the Base pipeline implements the base empty functions for these for
now.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
0eeb7e47b0 ostree: rename ResolveParams to Resolve 2023-05-31 16:40:07 +02:00
Achilleas Koutsou
fc5461e9e3 ostree: rename RequestParams to SourceSpec
Same as with the container SourceSpec, the struct specifies the required
information to resolve an ostree commit from a source (URL, ref, and
optional parent).
Renaming for consistency.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
00d473c802 container: create a SourceSpec for the resolve parameters
Create a struct to conveniently hold the source parameters for a
container resolve request and use it in the Add() function of the
resolver.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
30dc8cb87a manifest: expand the manifest package doc
Expand the manifest package documentation and move it to the manifest.go
file.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
c7aecdf31c distro: delete distro.Manifest type
Delete the distro.Manifest type and its tests.
Change all occurrences of distro.Manifest to manifest.OSBuildManifest.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
5498764725 manifest: serialize to OSBuildManifest instead of distro.Manifest
Copy the Marshal and Unmarshal functions from distro.Manifest to
manifest.OSBuildManifest to keep the same behaviour.

The Version() function isn't used, so let's drop it.
2023-05-31 16:40:07 +02:00
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
Achilleas Koutsou
0f925c445c subscription: new package for subscription options
Move the subscription options from distro to its own package.
Now we can import the manifest package into the distro package (instead
of the other way around) so we can work with the manifest.Manifest type
in distro.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
ea305d9c0f distro: simplify checkOptions() arguments
Make checkOptions() take the whole blueprint and options.  There is no
need to pass in the resolved containers separately since we only care
whether there are any containers defined for image types that don't
support them.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
e4e411a4c1 distro/rhel7: move imageType implementation to separate file 2023-05-31 16:40:07 +02:00
Achilleas Koutsou
31fd40f359 distro/fedora: move imageType implementation to separate file 2023-05-31 16:40:07 +02:00
Achilleas Koutsou
3d9dcff7f6 distro: inline initializeManifest
Inline the initializeManifest() function so we can start simplifying the
PackageSets() and Manifest() (the two callers) separately.
2023-05-31 16:40:07 +02:00
Gianluca Zuccarelli
388e2572d7 internal/osbuild: add missing sslverify field
The blueprint customizations enabled the `sslverify`
field. However, this has not been implemented yet in
the yum repos stage.
2023-05-31 16:24:36 +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
Sanne Raymaekers
e91dcae110 fedora: add ova image type 2023-05-25 10:14:32 +02:00
Sanne Raymaekers
a7c02245ee rhel8: add ova image type 2023-05-25 10:14:32 +02:00
Sanne Raymaekers
39f1e74d73 rhel9: add ova image type 2023-05-25 10:14:32 +02:00
Sanne Raymaekers
1687937c51 internal/image: add ova support to live image 2023-05-25 10:14:32 +02:00
Sanne Raymaekers
53fa47f104 internal/osbuild: add ovf stage 2023-05-25 10:14:32 +02:00
Tomáš Hozza
0292725ce4 internal/GCP: remove all remaining uses of cloudbuild
Some uses of `cloudbuild` GCP API have been left in our internal cloud
API implementation for GCP. We do not use `cloudbuild` to import GCE
images into GCP any more.

Do not request the `cloudbuild` authentication scope when getting new
GCP client.

Update vendored packages accordingly.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-24 19:28:06 +02:00
Tomáš Hozza
f335096f66 distro/rhel9: revert hybrid boot on RHEL EC2 (RHUI) images before 9.3
For backward compatibility, revert changes related to hybrid boot mode
for RHEL (RHUI) EC2 images before 9.3 release.

This change does not affect CentOS Stream 9 AMI images nor the RHEL AMI
build by the service or on-premise.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-23 13:04:31 +02:00
Tomáš Hozza
3eb5779e8b distro/rhel8: revert hybrid boot on RHEL EC2 (RHUI) images before 8.9
For backward compatibility, revert changes related to hybrid boot mode
for RHEL (RHUI) EC2 images before 8.9 release.

This change does not affect CentOS Stream 8 AMI images nor the RHEL AMI
build by the service or on-premise.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-23 13:04:31 +02:00
Sanne Raymaekers
8e637848e4 internal/manifest: execute rhc's post install script
The post install script customises the selinux policy, but is gated on
`selinuxenabled`, which will fail inside the buildroot container.

As a result it's never executed.
2023-05-22 21:39:14 +02:00
Paul Whalen
cd5cc08ce6 iot: add fedora-release-iot to iot-installer
Signed-off-by: Paul Whalen <pwhalen@fedoraproject.org>
2023-05-22 17:15:56 +02:00
Tomáš Hozza
9ab20f72b0 distro/fedora: restrict allowed 'iot-raw-image' type customizations
Previously, the rest was mostly silently ignored without errors.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
76cbec2149 distro/el8: restrict allowed 'edge-raw-image' type customizations
Previously, the rest was mostly silently ignored without errors.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
2cd7074b23 distro/el9: restrict allowed 'edge-raw-image' type customizations
Previously, the rest was mostly silently ignored without errors.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
f24e2cb175 image/ostree-raw: pass services from workload to the pipeline
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
c53471a3f6 manifest/ostree-deployment: support services customization
One of the IOT use cases for custom files and directories is to be able
to enable a custom systemd unit. This was previously not possible to do
via BP Customizations.

In addition, the test case for custom files and directories in
ostree-based images (currently only build-time images) takes advantage
of enabling a custom systemd unit file, this this will enable using the
same test scenario also for deploy-time ostree image types.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
edf3a38b29 distro/fedora: hook up custom dirs / files for iot raw-image
Set the user provided BP customizations related to custom files and
directories to the iot raw-image type, to ensure that these get
created while deploying a commit.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
bca3f72657 image/ostree-raw: pass directories and files customization to pipeline
Extend the `OSTreeRawImage` with a slice of custom directories and
files, that can be created in the image. Pass these down to the ostree
deployment pipeline, so that it can add necessary osbuld stages if any
directories or files were specified by user.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
141611f698 manifest/ostree-deployment: support directories and files customization
Extend the `OSTreeDeployment` with a list of custom files and
directories, that can be created in the deployed ostree commit. This
functionality is equivalent to the one that was added for the OS
pipeline.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +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
Brian C. Lane
468c63d433 weldr: Expand package name globs in the frozen blueprint
When a blueprint containing package name globs is frozen it was failing
because it could not find the string in the dependency list. This fixes
it by replacing the package glob with all of the matching packages from
the dependency list.

This removes the setPkgEVRA function and adds a new expandBlueprintGlobs
function that handles the package name glob expansion, and replacement of
the version globs with the dependency EVRA.

Also includes testing for the new function.
2023-05-19 08:14:33 -07:00
Brian C. Lane
f378ff6367 rpmmd: Add NEVRA helper functions to PackageSpec
GetEVRA will return the Epoch:Version-Release.Arch string, and
GetNEVRA will return Name-Epoch:Version-Release.Arch
with Epoch being left off if it is zero.

Also includes tests.
2023-05-19 08:14:33 -07:00
Brian C. Lane
c7bc25cead tests: Add a test for freezing a blueprint with globs
This is currently failing (fixed in the next commit). It tests to make
sure that a blueprint with package name globs can be frozen. The
resulting blueprint should replace the glob entries with the expanded
list of packages.
2023-05-19 08:14:33 -07:00