Skip to content

Commit 0802b0c

Browse files
committed
utils: collect artifacts to build as a Set
Collect all artifacts in a Set to support the `skip_disk_images` knob. This avoids Jenkins script security errors when using `intersect()`.
1 parent 7e408da commit 0802b0c

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

utils.groovy

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,23 +414,22 @@ def get_push_trigger() {
414414
// Gets desired artifacts to build from pipeline config
415415
def get_artifacts_to_build(pipecfg, stream, basearch) {
416416
// Explicit stream-level override takes precedence
417-
def artifacts = pipecfg.streams[stream].artifacts?."${basearch}"
418-
if (artifacts == null) {
419-
// calculate artifacts from defaults + additional - skip
420-
artifacts = []
421-
artifacts += pipecfg.default_artifacts.all ?: []
422-
artifacts += pipecfg.default_artifacts."${basearch}" ?: []
423-
artifacts += pipecfg.streams[stream].additional_artifacts?.all ?: []
424-
artifacts += pipecfg.streams[stream].additional_artifacts?."${basearch}" ?: []
425-
artifacts -= pipecfg.streams[stream].skip_artifacts?.all ?: []
426-
artifacts -= pipecfg.streams[stream].skip_artifacts?."${basearch}" ?: []
417+
def artifacts = (pipecfg.streams[stream].artifacts?."${basearch}" ?: []) as Set
418+
if (artifacts.isEmpty()) {
419+
// calculate artifacts from defaults, add additional, remove skip
420+
artifacts.addAll(pipecfg.default_artifacts.all ?: [])
421+
artifacts.addAll(pipecfg.default_artifacts."${basearch}" ?: [])
422+
artifacts.addAll(pipecfg.streams[stream].additional_artifacts?.all ?: [])
423+
artifacts.addAll(pipecfg.streams[stream].additional_artifacts?."${basearch}" ?: [])
424+
artifacts.removeAll(pipecfg.streams[stream].skip_artifacts?.all ?: [])
425+
artifacts.removeAll(pipecfg.streams[stream].skip_artifacts?."${basearch}" ?: [])
427426
}
428427
if (pipecfg.streams[stream].skip_disk_images) {
429428
// Only keep the extensions container. Note that the ostree container
430429
// and QEMU image are always built and not skippable artifacts.
431430
artifacts = artifacts.intersect(["extensions-container"])
432431
}
433-
return artifacts.unique()
432+
return artifacts
434433
}
435434

436435
// Build all the artifacts requested from the pipeline config for this arch.

0 commit comments

Comments
 (0)