Skip to content

Commit b942a91

Browse files
committed
osbuild: create artifact files with final filenames
Turns out we can stencil in the name of the artifacts we want to create and just have OSBuild go ahead and write files to the right name. Also dropped an extra copy that's not really necessary.
1 parent 483126e commit b942a91

12 files changed

+38
-27
lines changed

src/cmd-osbuild

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ generate_runvm_osbuild_config() {
183183

184184
# Generate the JSON describing the disk we want to build
185185
yaml2json /dev/stdin "${runvm_osbuild_config_json}" <<EOF
186+
artifact-name-prefix: "${name}-${build}"
186187
container-imgref: "${container_imgref}"
187188
deploy-via-container: "${deploy_via_container}"
188189
osname: "${name}"
@@ -351,14 +352,11 @@ main() {
351352
--platforms "$(IFS=,; echo "${platforms[*]}")"
352353

353354
for platform in "${platforms[@]}"; do
354-
suffix="${SUPPORTED_PLATFORMS[$platform]}"
355-
356355
# Set the filename of the artifact and the local image path
357-
# where the file will reside temporarily and move it there
358-
# from the OSBuild out directory.
356+
# where from the OSBuild out directory where it resides.
357+
suffix="${SUPPORTED_PLATFORMS[$platform]}"
359358
imgname=${name}-${build}-${platform}.${basearch}.${suffix}
360-
imgpath=${PWD}/${imgname}
361-
mv "${outdir}/${platform}/${platform}" "${imgpath}"
359+
imgpath="${outdir}/${platform}/${imgname}"
362360

363361
# Perform postprocessing
364362
case "$platform" in

src/osbuild-manifests/coreos.osbuild.aarch64.mpp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
version: '2'
22
mpp-vars:
3+
artifact_name_prefix: $artifact_name_prefix
34
ostree_repo: $ostree_repo
45
ostree_ref: $ostree_ref
56
ociarchive: $ociarchive

src/osbuild-manifests/coreos.osbuild.ppc64le.mpp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
version: '2'
22
mpp-vars:
3+
artifact_name_prefix: $artifact_name_prefix
34
ostree_repo: $ostree_repo
45
ostree_ref: $ostree_ref
56
ociarchive: $ociarchive

src/osbuild-manifests/coreos.osbuild.s390x.mpp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
version: '2'
22
mpp-vars:
3+
artifact_name_prefix: $artifact_name_prefix
34
ostree_repo: $ostree_repo
45
ostree_ref: $ostree_ref
56
ociarchive: $ociarchive

src/osbuild-manifests/coreos.osbuild.x86_64.mpp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
version: '2'
22
mpp-vars:
3+
artifact_name_prefix: $artifact_name_prefix
34
ostree_repo: $ostree_repo
45
ostree_ref: $ostree_ref
56
ociarchive: $ociarchive

src/osbuild-manifests/platform.applehv.ipp.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ pipelines:
6565
options:
6666
paths:
6767
- from: input://tree/disk.img
68-
to: tree:///applehv
68+
to:
69+
mpp-format-string: 'tree:///{artifact_name_prefix}-applehv.{arch}.raw'

src/osbuild-manifests/platform.gcp.ipp.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pipelines:
6262
tree:
6363
type: org.osbuild.tree
6464
origin: org.osbuild.pipeline
65-
references:
65+
references:
6666
- name:raw-gcp-image
6767
options:
6868
filename: disk.tar
@@ -85,4 +85,5 @@ pipelines:
8585
name:raw-gcp-image-tar:
8686
file: disk.tar
8787
options:
88-
filename: gcp
88+
filename:
89+
mpp-format-string: '{artifact_name_prefix}-gcp.{arch}.tar.gz'

src/osbuild-manifests/platform.hyperv.ipp.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pipelines:
6464
name:raw-hyperv-image:
6565
file: disk.img
6666
options:
67-
filename: hyperv
67+
filename:
68+
mpp-format-string: '{artifact_name_prefix}-hyperv.{arch}.vhdx'
6869
format:
6970
type: vhdx

src/osbuild-manifests/platform.metal.ipp.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ pipelines:
9090
options:
9191
paths:
9292
- from: input://tree/disk.img
93-
to: tree:///metal
93+
to:
94+
mpp-format-string: 'tree:///{artifact_name_prefix}-metal.{arch}.raw'
9495
- name: raw-metal4k-image
9596
build:
9697
mpp-format-string: '{buildroot}'
@@ -183,4 +184,5 @@ pipelines:
183184
options:
184185
paths:
185186
- from: input://tree/disk.img
186-
to: tree:///metal4k
187+
to:
188+
mpp-format-string: 'tree:///{artifact_name_prefix}-metal4k.{arch}.raw'

src/osbuild-manifests/platform.qemu-secex.ipp.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ pipelines:
288288
name:raw-qemu-secex-image:
289289
file: disk.img
290290
options:
291-
filename: qemu-secex
291+
filename:
292+
mpp-format-string: '{artifact_name_prefix}-qemu-secex.{arch}.qcow2'
292293
format:
293294
type: qcow2
294295
compression: false

0 commit comments

Comments
 (0)