Skip to content

Commit

Permalink
support conditionally building artifacts in an OSBuild stage
Browse files Browse the repository at this point in the history
With coreos/coreos-assembler#3930 we can
now build multiple artifacts/platforms in a single OSBuild call.
Let's add support here for detecting what artifacts are supported
to be built by OSBuild and build them using OSBuild.

We segregate here "experimental" versus "stable" OSbuild built
artifacts and add a pipecfg knob for opting into the "experimental"
ones being built by OSBuild.
  • Loading branch information
dustymabe committed Nov 14, 2024
1 parent 057bebd commit 3e79eab
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ streams:
type: mechanical
env:
COSA_TESTISO_DEBUG: true
osbuild_experimental: true
# branched:
# type: mechanical
# env:
Expand Down
3 changes: 3 additions & 0 deletions docs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ streams:
check_kernel_rt_mismatch_rhcos: true
# OPTIONAL: list of kola tags to skip for this stream
skip_kola_tags: [openshift, needs-internet, luks]
# OPTIONAL: allow building using OSBuild for artifacts where OSBuild is
# not yet the default in CoreOS Assembler.
osbuild_experimental: true

# REQUIRED: architectures to build for other than x86_64
additional_arches: [aarch64, ppc64le, s390x]
Expand Down
36 changes: 36 additions & 0 deletions utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,42 @@ def build_artifacts(pipecfg, stream, basearch) {
// First get the list of artifacts to build from the config
def artifacts = get_artifacts_to_build(pipecfg, stream, basearch)

// If `cosa osbuild` is supported then let's build what we can using OSBuild
if (shwrapRc("cosa shell -- test -e /usr/lib/coreos-assembler/cmd-osbuild") == 0) {
// Determine which platforms are OSBuild experimental versus
// stable (i.e. the default is to use OSBuild for them).
def experimental = shwrapCapture("cosa osbuild --supported-platforms").tokenize()
def stable = shwrapCapture('''
cosa shell -- bash -c '
for buildextend in /usr/lib/coreos-assembler/cmd-buildextend-*; do
if [ "$(readlink -f ${buildextend})" == "/usr/lib/coreos-assembler/cmd-osbuild" ]; then
# the 42 here chops off /usr/lib/coreos-assembler/cmd-buildextend-
echo "${buildextend:42}"
fi
done
'
''').tokenize('\n')
// Based on the pipeline configuration we'll either use OSBuild for as
// much as we can (experimental) or just what it is the default for (stable)
def osbuild_supported_artifacts = stable
if (pipecfg.streams[stream].osbuild_experimental) {
osbuild_supported_artifacts = experimental
}
// Let's build separately the artifacts that can be built directly with OSBuild.
def osbuild_artifacts = []
for (artifact in artifacts) {
if (artifact in osbuild_supported_artifacts) {
osbuild_artifacts += artifact
}
}
if (!osbuild_artifacts.isEmpty()) {
artifacts.removeAll(osbuild_artifacts)
stage('💽:OSBuild') {
shwrap("cosa osbuild ${osbuild_artifacts.join(' ')}")
}
}
}

// Next let's do some massaging of the inputs based on two problems we
// need to consider:
//
Expand Down

0 comments on commit 3e79eab

Please sign in to comment.