Skip to content

Commit abc2f15

Browse files
committed
support conditionally building artifacts in an OSBuild stage
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.
1 parent 057bebd commit abc2f15

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ streams:
1616
type: mechanical
1717
env:
1818
COSA_TESTISO_DEBUG: true
19+
osbuild_experimental: true
1920
# branched:
2021
# type: mechanical
2122
# env:

docs/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ streams:
9898
check_kernel_rt_mismatch_rhcos: true
9999
# OPTIONAL: list of kola tags to skip for this stream
100100
skip_kola_tags: [openshift, needs-internet, luks]
101+
# OPTIONAL: allow building using OSBuild for artifacts where OSBuild is
102+
# not yet the default in CoreOS Assembler.
103+
osbuild_experimental: true
101104

102105
# REQUIRED: architectures to build for other than x86_64
103106
additional_arches: [aarch64, ppc64le, s390x]

utils.groovy

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,41 @@ def build_artifacts(pipecfg, stream, basearch) {
427427
// First get the list of artifacts to build from the config
428428
def artifacts = get_artifacts_to_build(pipecfg, stream, basearch)
429429

430+
// If `cosa osbuild` is supported then let's build what we can using OSBuild
431+
if (shwrapRc("cosa shell -- test -e /usr/lib/coreos-assembler/cmd-osbuild") == 0) {
432+
// Determine which platforms are OSBuild experimental versus
433+
// stable (i.e. the default is to use OSBuild for them).
434+
def experimental = shwrapCapture("cosa osbuild --supported-platforms").tokenize()
435+
def stable = shwrapCapture('''
436+
cosa shell -- bash -c '
437+
for buildextend in /usr/lib/coreos-assembler/cmd-buildextend-*; do
438+
if [ "$(readlink -f ${buildextend})" == "/usr/lib/coreos-assembler/cmd-osbuild" ]; then
439+
echo "${buildextend:42}"
440+
fi
441+
done
442+
'
443+
''').tokenize('\n')
444+
// Based on the pipeline configuration we'll either use OSBuild for as
445+
// much as we can (experimental) or just what it is the default for (stable)
446+
def osbuild_supported_artifacts = stable
447+
if (pipecfg.streams[stream].osbuild_experimental) {
448+
osbuild_supported_artifacts = experimental
449+
}
450+
// Let's build separately the artifacts that can be built directly with OSBuild.
451+
def osbuild_artifacts = []
452+
for (artifact in artifacts) {
453+
if (artifact in osbuild_supported_artifacts) {
454+
osbuild_artifacts += artifact
455+
}
456+
}
457+
if (!osbuild_artifacts.isEmpty()) {
458+
artifacts.removeAll(osbuild_artifacts)
459+
stage('💽:OSBuild') {
460+
shwrap("cosa osbuild ${osbuild_artifacts.join(' ')}")
461+
}
462+
}
463+
}
464+
430465
// Next let's do some massaging of the inputs based on two problems we
431466
// need to consider:
432467
//

0 commit comments

Comments
 (0)