Skip to content

Commit

Permalink
cmdlib: Support deriving name from manifest, summary from image.yaml
Browse files Browse the repository at this point in the history
Prep for variant builds:
coreos#1459

This way variant builds can simply use separate filenames rather
than redundantly specifying the name in the `rojig` section (which
was always awkward to start with).
  • Loading branch information
cgwalters committed May 22, 2020
1 parent b06ea31 commit f67b042
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,16 @@ prepare_build() {
manifest_tmp_json=${workdir}/tmp/manifest.json
rpm-ostree compose tree --repo="${tmprepo}" --print-only "${manifest}" > "${manifest_tmp_json}"

# Abuse the rojig/name as the name of the VM images
# Also grab rojig summary for image upload descriptions
name=$(jq -r '.rojig.name' < "${manifest_tmp_json}")
summary=$(jq -r '.rojig.summary' < "${manifest_tmp_json}")
if [ "$(jq -r '.rojig' < "${manifest_tmp_json}")" == "null" ]; then
name=$(basename "$(realpath "${manifest}")" .yaml)
summary=$(python3 -c 'import sys, yaml; print(yaml.safe_load(sys.stdin).get("summary"))' < "$configdir/image.yaml")
else
# Abuse the rojig/name as the name of the VM images
# Also grab rojig summary for image upload descriptions
name=$(jq -r '.rojig.name' < "${manifest_tmp_json}")
summary=$(jq -r '.rojig.summary' < "${manifest_tmp_json}")
fi

ref=$(jq -r '.ref' < "${manifest_tmp_json}")
ref_is_temp=""
if [ "${ref}" = "null" ]; then
Expand Down

0 comments on commit f67b042

Please sign in to comment.