Commit graph

221 commits

Author SHA1 Message Date
Achilleas Koutsou
8d9f52cf1f go.mod: update osbuild/images (v0.172.0) and osbuild/blueprint (v1.12.0)
The internal blueprint implementation has been removed from
osbuild/images.  Conversion from osbuild/blueprint blueprints to
osbuild/images blueprints is no longer necessary.
2025-08-07 20:15:33 +02:00
Achilleas Koutsou
deccaf9548 go.mod: update osbuild/images to v0.151.0
tag v0.149.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.149.0

----------------
  * Update dependencies 2025-05-25 (osbuild/images#1560)
    * Author: SchutzBot, Reviewers: Simon de Vlieger, Tomáš Hozza
  * Update osbuild dependency commit ID to latest (osbuild/images#1522)
    * Author: SchutzBot, Reviewers: Simon de Vlieger, Tomáš Hozza
  * Update snapshots to 20250515 (osbuild/images#1524)
    * Author: SchutzBot, Reviewers: Simon de Vlieger, Tomáš Hozza
  * `vagrant-libvirt` implementation (HMS-6116) (osbuild/images#1548)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * fedora: tweaks after all imageTypes are YAML (osbuild/images#1518)
    * Author: Michael Vogt, Reviewers: Simon de Vlieger, Tomáš Hozza
  * gha: do not break gobump output (osbuild/images#1561)
    * Author: Lukáš Zapletal, Reviewers: Simon de Vlieger, Tomáš Hozza
  * repositories: AlmaLinux 10 (osbuild/images#1567)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Lukáš Zapletal, Neal Gompa (ニール・ゴンパ)
  * vagrant: image config for default vagrant user (HMS-6116) (osbuild/images#1565)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Michael Vogt

— Somewhere on the Internet, 2025-05-27

---

tag v0.150.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.150.0

----------------
  * Replace hardcoded kickstart %post scripts with new stage options and bootc switch with custom kickstart content (HMS-6051) (osbuild/images#1527)
    * Author: Achilleas Koutsou, Reviewers: Simon de Vlieger, Tomáš Hozza
  * test: install yamllint for tests (osbuild/images#1572)
    * Author: Achilleas Koutsou, Reviewers: Lukáš Zapletal, Simon de Vlieger, Tomáš Hozza

— Somewhere on the Internet, 2025-06-02

---

tag v0.151.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.151.0

----------------
  * Introduce new Azure CVM image type (HMS-5636) (osbuild/images#1318)
    * Author: Achilleas Koutsou, Reviewers: Nobody
  * Many: support using string with unit for byte-sized partitioning fields in YAML distro definitions (osbuild/images#1579)
    * Author: Tomáš Hozza, Reviewers: Achilleas Koutsou, Brian C. Lane
  * Update osbuild dependency commit ID to latest (osbuild/images#1587)
    * Author: SchutzBot, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * Update snapshots to 20250601 (osbuild/images#1573)
    * Author: SchutzBot, Reviewers: Achilleas Koutsou, Lukáš Zapletal
  * bootc: Make installed rootfs configurable (osbuild/images#1555)
    * Author: Mbarak Bujra, Reviewers: Michael Vogt, Tomáš Hozza
  * distro: create new ImageConfig.DNFConfig (osbuild/images#1583)
    * Author: Michael Vogt, Reviewers: Simon de Vlieger, Tomáš Hozza
  * distro: make "fedora" a "generic" distro (osbuild/images#1563)
    * Author: Michael Vogt, Reviewers: Nobody
  * image: If using a separate build container, copy bootc customization to it (osbuild/images#1571)
    * Author: Alexander Larsson, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * manifest/ostree: explicitly include shadow-utils (osbuild/images#1585)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Michael Vogt
  * osbuild/tar: explicit compression (HMS-8573, HMS-6116) (osbuild/images#1581)
    * Author: Simon de Vlieger, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * tests: bump fedora versions to 41 (osbuild/images#1438)
    * Author: Lukáš Zapletal, Reviewers: Brian C. Lane, Michael Vogt

— Somewhere on the Internet, 2025-06-09

---
2025-06-23 14:37:30 +01:00
Achilleas Koutsou
cf956ff5a6 Delete internal/blueprint/ and import from osbuild/blueprint
Import osbuild/blueprint v1.6.0
2025-04-17 11:17:58 +02:00
Sanne Raymaekers
d6fe9d85cf weldr: adapt tests to modularity 2025-03-20 14:07:52 +01:00
Michael Vogt
af0543d27c many: update images Manifest() API for PR#1107
This updates composer to use the updated API in images around the
seed handling for manifests, see images PR#1107 for details.

Note that this has no semantic changes yet. We could now simplfy
some things because images will auto-seed but that is for a followup.
2025-01-20 09:50:49 +01:00
Sanne Raymaekers
d0a6828bd7 osbuild/images update: ignore repoconfigs where appropriate 2024-04-17 10:27:08 +02:00
Tomáš Hozza
625b1578fa Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation"
for distro release versions.

 - Replace all uses of distroregistry by distrofactory.
 - Delete local version of reporegistry and use the one from the
   osbuild/images.
 - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single
   `createTestWeldrAPI()` function`.
 - store/fixture: rework fixtures to allow overriding the host distro
   name and host architecture name. A cleanup function to restore the
   host distro and arch names is always part of the fixture struct.
 - Delete `distro_mock` package, since it is no longer used.
 - Bump the required version of osbuild to 98, because the OSCAP
   customization is using the 'compress_results' stage option, which is
   not available in older versions of osbuild.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Ondrej Ezr
4b3b942dde cloudapi: Add module_hotfixes flag
Allow passing module_hotfixes flag through the cloudapi.
This will enable depsolving on repositories that might be affected by modularity filtering.

Refs HMS-3202
2023-12-20 09:02:06 +01:00
Sanne Raymaekers
c6aa7d88d2 internal/weldr: specify architecture of compose
This is useful in environments with multi-arch remote workers.
Defaults to the host architecture.
2023-12-14 21:25:32 +01:00
Tomáš Hozza
1afe7d20c8 Adjust code to new version of osbuild/images
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-12-06 17:32:18 +01:00
Brian C. Lane
aca748bc14 Don't Panic in getComposeStatus and skip invalid jobs in fsjobqueue New
This handles corrupt job json files by skipping them. They still exist,
and errors are logged, but the system keeps working.

If one or more of the json files in /var/lib/osbuild-composer/jobs/
becomes corrupt they can stop the osbuild-composer service from
starting, or stop commands like 'composer-cli compose status' from
working because they quit on the first error and miss any job that
aren't broken.
2023-11-20 13:34:40 +01:00
Brian C. Lane
8e933f84f9 store: Fix test for CheckGPG
Forgot the #1 rule of map iteration. Don't depend on the order.
This uses a slice instead, which should be just as good for testing the
loop variable alias behavior.
2023-11-01 23:10:51 +01:00
Brian C. Lane
b786178077 store: Fix SourceConfig.RepoConfig() function call
The SourceConfig pointer may be a loop variable that gets reused. This
results in unexpected behavior when the value pointed to is overwritten
by the loop calling this function.

Includes a test to make sure this is fixed.

So, DO NOT point to unsafe variables. Make a new pointer using
common.ToPtr where it is passed by value and returns a pointer to that
new value.

NOTE: This is NOT caught by golangci-lint. There may be other places
where this happens, but I have gone through the potential looking code
in osbuild-composer and images and not found any (other than a couple
places already noted with G601 tags as not a problem).
2023-11-01 11:38:41 +01:00
Tomáš Hozza
b41705adfb Delete unused internal/platform package
This is a leftover from the `osbuild/images` split`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-10-20 18:59:00 +02:00
Achilleas Koutsou
0e4a9e586f split: replace internal packages with images library
Remove all the internal package that are now in the
github.com/osbuild/images package and vendor it.

A new function in internal/blueprint/ converts from an osbuild-composer
blueprint to an images blueprint.  This is necessary for keeping the
blueprint implementation in both packages.  In the future, the images
package will change the blueprint (and most likely rename it) and it
will only be part of the osbuild-composer internals and interface.  The
Convert() function will be responsible for converting the blueprint into
the new configuration object.
2023-07-10 21:11:19 +02:00
Achilleas Koutsou
89a398371d manifest: add resolved commit specs to Serialize()
Same as with package specs and container specs, the commit specs are
added to the manifest serialization after being resolved.
2023-06-14 11:19:29 +02:00
Achilleas Koutsou
3b1d48ec99 distro: remove packageSpecSets and containers from Manifest() args
The arguments aren't used in the function anymore.
2023-05-31 16:40:07 +02:00
Achilleas Koutsou
267a27a1a8 manifest: container specs added during serialization
Add a second argument, map[string][]container.Spec, during
serialization, which serves the same purpose as the depsolved package
sets.
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
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
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
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
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
Irene Diez
8022c227ba distro: allow to return warnings in the Manifest function
This changes the `Manifest` function of the `ImageType`
interface so that any warnings detected during the
`checkOptions` step of the manifest initialization can
be propagated back to the Weldr-API (see next commit).

Signed-off-by: Irene Diez <idiez@redhat.com>
2023-03-31 14:14:57 +02: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
Brian C. Lane
d5e666cc9c tests: Add tests for new repo gpg support
Add testing for gpgkeys and check_repogpg.
2023-02-01 10:27:58 +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
Sarita Mahajan
0d16e2310e image: add new image type "minimal-raw" for fedora
Signed-off-by: Sarita Mahajan <sarmahaj@redhat.com>
2023-01-25 19:19:45 +01:00
Ondřej Budai
b997142db0 common: merge all *ToPtr methods to one generic ToPtr
After introducing Go 1.18 to a project, it's required by law to convert at
least one method to a generic one.

Everyone hates IntToPtr, StringToPtr, BoolToPtr and Uint64ToPtr, so let's
convert them to the ultimate generic ToPtr one.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-01-09 14:03:18 +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
Achilleas Koutsou
8612131351 store: add containers to test 2022-11-28 17:20:49 +01:00
Brian C. Lane
0b864c4306 store: Add blueprints to the stored changes
Previously the blueprint change was only present until a reboot. The
change and its version was recorded, but the actual blueprint was not
saved.

This adds saving the blueprint when it is changed, and loading the old
blueprint versions when they are present in the store.

No version change is needed, if the blueprint is not present it is
loaded as an empty blueprint which was already being detected by
checking the length of the Name.

This will allow specific blueprint changes to be recalled after a
restart of the server.

This also includes tests for the new behavior.
2022-11-24 11:19:14 +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
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
f32e653315 store: trim compat string map
The map is meant to maintain compatibility with changes in image type
names.  Most entries however map to themselves.  It's redundant to keep
updating this map with every new image type name and map it to itself.
Instead, check the map for a compat string and if one doesn't exist,
return the original.

Conversely, when the inverse lookup is performed, first check if the
compat string is a valid image type name and only iterate the map if
it's not.

Now we don't need to update the map every time we introduce a new image
type, unless we need to map an old name to a new one.
2022-09-13 16:06:19 +01:00
Christian Kellner
7f3f016ed1 distro: add containers arg to ImageType.Manifest
This is the first step to support embedding container images. Here
we add the `containers []container.Spec` argument to supply images
with resolved container specifications. For now all distros will
return an error in case a container is actually supplied since none
of them currently support embedding containers. NB: also no apis or
tools will actually resolve containers.
2022-07-21 13:32:07 +02:00
Achilleas Koutsou
9d4a351ca6 Rename osbuild2 package to osbuild 2022-07-14 16:54:00 +02:00
Achilleas Koutsou
c1956ba6e1 Use osbuild2 Manifest in all tests
The test_distro Manifest, which is used in tests across multiple
packages, was using the old structure.  Updated to the v2 structure and
adapted all tests.
2022-07-14 16:54:00 +02:00
Tomas Hozza
6f464949f5 target: move Filename from target options to Target
The filename of the image as produced by osbuild for a given export is
currently set in each target options type in the `Filename` struct
member. However, the value is not really specific to any target type,
but to the specific export used for the target. For this reason move the
value form target type options to the `Target` struct inside a new
struct `OsbuildArtifact` under the name`ExportFilename`.

The backward compatibility with older implementations of the composer
and workers is kept on the JSON (Un)mashaling level, where the JSON
object is always a super-set of the old and new way of providing the
export filename in the Target.
2022-07-01 18:55:01 +01:00
Tomas Hozza
40abb32dec target: deprecate local target and don't use it anywhere
Completely remove the use of `local` target from all code, which is not
required to keep backward compatibility. The target has not been used in
composer for some time already, but some unit tests still used its data
structures. Mark the target as deprecated and adjust all unit tests that
depended on it.

The backward compatibility is kept mostly to enable long running
osbuild-composer instances, which were upgraded to still read old jobs
from the store.

While a target with the same intention will be reintroduced, the current
`local` target data structures contain many fields which would not be
relevant for the new target.

In addition, while the "local" target will be ever used only by Weldr
API, the name would be a bit misleading. Although the worker usually
runs on the same system when using Weldr API, there is no hard
requirement enforcing this setup. In reality, the worker will be
uploading the image back to the worker server, so there is room for a
better name.
2022-07-01 18:55:01 +01:00
Tomas Hozza
a7b97697de store: delete unused GetLocalTargetOptions() method 2022-07-01 18:55:01 +01:00
Tomas Hozza
c63bfe6d83 target: use constants for target names, instead of string literals 2022-07-01 18:55:01 +01:00
Christian Kellner
c5a5da5f56 distro/fedora: add container image type
Add a container image type that is based on the existing fedora
container image. There is a delta in terms of the configuration
because osbuild does not yet provide all the neccessary means,
but the package set is already very close.
2022-06-29 10:02:46 +02:00
Jordi Gil
f14dc2fb63 distro/fedora: refactor based on RHEL 9.0 code 2022-05-09 12:25:21 +02:00
Tomas Hozza
0219ad1f43 RHEL-86: add gce-rhui image type
Add the `gce-rhui` image type intended for Google Compute Engine. The image
uses Google's RHUI infrastructure to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
5d27b7c784 RHEL-90: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00