ostree-raw-image.sh and ostree-simplified-installer.sh
Don't need dedicated rebase test workflow, move rebase test into
other test script. That will save runner and reduce running time
Add BIOS rebase test in ostree-raw-image.sh
Add UEFI rebase test in ostree-simplified-installer.sh
PR#3421 [1] unintentionally removed the `rhui-azure-rhel8` package from
the Azure EAP7 RHUI image base package set. As a result, the image
manifest can't be built successfully. The reason is that the removed
package installs a RPM GPG key, which is hard-coded in the image manifest
to be imported as part of the image build.
Add the package back to the image base package set and regenerate all
affected test manifests.
[1] https://github.com/osbuild/osbuild-composer/pull/3421
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Since we only need to retrieve the file names, we can use
`(*os.File).Readdirnames` to avoid reading the whole file info for
better performance.
Sample benchmark:
func Benchmark_Readdir(b *testing.B) {
for i := 0; i < b.N; i++ {
f, err := os.Open("/")
if err != nil {
b.Fatal(err)
}
_, err = f.Readdir(-1)
if err != nil {
f.Close()
b.Fatal(err)
}
f.Close()
}
}
func Benchmark_Readdirnames(b *testing.B) {
for i := 0; i < b.N; i++ {
f, err := os.Open("/")
if err != nil {
b.Fatal(err)
}
_, err = f.Readdirnames(-1)
if err != nil {
f.Close()
b.Fatal(err)
}
f.Close()
}
}
goos: linux
goarch: amd64
pkg: github.com/osbuild/osbuild-composer/internal/jsondb
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
Benchmark_Readdir-16 31304 33551 ns/op 5638 B/op 70 allocs/op
Benchmark_Readdirnames-16 128443 12124 ns/op 1228 B/op 30 allocs/op
PASS
ok github.com/osbuild/osbuild-composer/internal/jsondb 3.098s
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
- not used in oscap.sh test at all
- causes VM in libvirt.sh test to acquire a different IP address instead
of the hard-coded one inside the test, which causes SSH to fail
- not used anywhere else
Edge and IoT manifests are modified from the new option handling. The
"parent" commit ID isn't specified in the options anymore, but it is
(fake) resolved by the manifest generator.
Of particular note is the iot-raw-image manifest that now properly uses
the commit ID in the copy stage for the firmware.
The resolved ostree commits are now stored in the content part of the
manifest metadata alongside package specs and containers.
Add a checksum as a hash of URL + Ref.
Use the parent ref instead of the image ref when it's set. This makes
the test distro always behave like ostree commit and container types
(image types that can use an ostree parent) and not raw image or
installers (that use ostree commits as a payload).
Modify the weldr API test with the expected error message.
Use ostree.ImageOptions for the request parameters instead of a
SourceSpec on the imageRequest.
When preparing the image request, add the ostree values from the API's
compose request to the ostree options on the image options of the image
request.
It's not necessary to create a source spec and it's also not necessary
to add the default ref when it's not specified in the request for an
ostree-based image type. Both of these will be handled by the Manifest
generation based on the ostree options (imageOptions.OSTree). The image
functions will take care of setting any missing parameters or returning
errors if any required parameters are missing.
Change the OSTreeResolveSpec to match the ostree SourceSpec by removing
the Parent field.
Change OSTreeResolveResultSpec to match the CommitSpec by adding the
Secrets field. The RHSM field is kept for backwards compatibility with
older workers.
The Resolve() function is now only responsible for resolving a
SourceSpec to a CommitSpec. It only resolves a checksum if a URL is set
and sets the option for the RHSM secrets.
The Parent has been removed from the SourceSpec. The SourceSpec is a
simple reference to a single ostree ref and has no connection with the
ostree options.
The ostree options for a compose request should be specified using the
ImageOptions struct, not the source spec. The source spec should be
specifying the source parameters for a single ostree commit internally.
Add a Distro enum to the Manifest struct for selecting package
selection.
Packages are sometimes renamed between distribution versions and since
we do the package selection in the Manifest, we need a way to select
distro-version-specific package names inside the manifest initialiser.
This may change in the future.
Do not expose the content of the manifest statically and instead rely on
the public methods to retrieve source specifications dynamically.
Since the methods require iterating through the pipelines to collect
source specifications, we should avoid calling the function multiple
times when we can reuse the returned values.
The new test_distro's manifest produces a slightly different empty
manifest when serialized even without content. Cloud API and Koji tests
have been adapted to match.
Weldr tests have been updated in several ways:
- The test_distro content resolver is used to resolve manifest content
before serializing.
- The test scenarios in TestCompose have been named for easier
troubleshooting (easier to identify a failing test by name).
- Manifests that work with the secondary ostree repo (the "other") use
the appropriate URL and ref and create a secondary "other" serialized
manifest.
The weldr API's test flag for resolving ostree commits does not produce
the same, fixed hash every time but instead computes a sha256 from the
URL + ref, like we do in the test manifests.
Define a public pipeline implementation that allows initialising with
content, serialising with resolved content, but produces no stages.
This is useful for testing.
Initialise the manifest only once in the enqueue functions
(ImageType.Manifest()) and pass it to the manifest generation function
with the workers and the dependency IDs. The function is renamed from
generateManifest() to serializeManifest() to reflect its new
functionality more accurately. The arguments to the function have also
been trimmed since we no longer need the image type, blueprint, and
image options.
The new functionality of the function is to collect all the resolved
content from the workers and serialize the manifest object.
Use the container sources provided by the content on the initialised
manifest instead of the blueprint to resolve containers. The container
sources on the manifest are a map keyed by the name of the pipeline that
will use the resolved containers, but the worker's container resolve job
works on a slice, so we reread the content map to get the pipeline name
(instead of taking the first payload pipeline from the image type).
This requires that there be only one pipeline that embeds containers,
which currently true of all our image types.
Use the commit sources provided by the content on the initialised
manifest instead of the image options to resolve commits. The ostree
sources on the manifest are a map keyed by the name of the pipeline that
will use the resolved commit spec, but unlike with the package sets, the
worker's commit resolve job works on a slice, so we reread the content
map to get the pipeline name. This requires that there be only one
pipeline that requires a resolved ostree commit, which is currently true
of all our image types.
Setting the default ostree ref on the image options before calling
Manifest() isn't needed anymore.
OSTree commits are now resolved after manifest initialisation just like
packages and containers. The test commit hash handling is moved to the
resolver function.