Skip to content

Commit 89e104d

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: 1. Detecting if an artifact supports building via OSBuild by looking to see if the buildextend-{artifact} API points to cmd-osbuild. i.e. is OSBuild the default for this artifact? 2. Allowing the pipecfg to specify additional artifacts to build using OSBuild. This is useful if OSBuild is not yet the default way to build this particular artifact.
1 parent 057bebd commit 89e104d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-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_artifacts: [applehv, gcp, hyperv]
1920
# branched:
2021
# type: mechanical
2122
# env:

docs/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ 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: list of artifacts to additionally build using OSBuild
102+
osbuild_artifacts: [applehv, gcp, hyperv]
101103

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

utils.groovy

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,26 @@ 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+
// Let's build separately the artifacts that can be built directly
431+
// with OSBuild. There are two ways something can get added to the
432+
// list of OSBuild built artifacts:
433+
// 1. It is specified in the space separated string in env.COSA_OSBUILD_ARTIFACTS
434+
// 2. If the `cmd-buildextend-{artifact}` node is a symlink to `cmd-osbuild`
435+
def osbuild_artifacts = pipecfg.osbuild_artifacts ?: []
436+
for (artifact in artifacts) {
437+
source = "/usr/lib/coreos-assembler/cmd-buildextend-{artifact}"
438+
target = shwrapCapture("cosa shell -- readlink -f ${source} | xargs basename")
439+
if (target == 'cmd-osbuild') {
440+
osbuild_artifacts += artifact
441+
}
442+
}
443+
if osbuild_artifacts.length() > 0 {
444+
artifacts.remove(osbuild_artifacts)
445+
stage('💽:OSBuild') {
446+
shwrap("cosa osbuild --platforms ${osbuild_artifacts.join(',')}")
447+
}
448+
}
449+
430450
// Next let's do some massaging of the inputs based on two problems we
431451
// need to consider:
432452
//

0 commit comments

Comments
 (0)