Skip to content

Commit

Permalink
Move image-default.yaml merge into main build
Browse files Browse the repository at this point in the history
A while ago we added an `image-default.yaml`, but were only using
it in the disk image builds.  Move it into the main build setup,
so we can consistently refer to values that may have defaults there
too.

Prep for extending `ostree-format`.
  • Loading branch information
cgwalters authored and jlebon committed Apr 1, 2022
1 parent cbebd68 commit 4b61566
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 5 additions & 9 deletions src/cmd-buildextend-metal
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,14 @@ if [ "${image_type}" = dasd ] || [ "${image_type}" = metal4k ]; then
ignition_platform_id=metal
fi

yaml2json "/usr/lib/coreos-assembler/image-default.yaml" image-default.json
# Combine with the defaults
cat image-default.json "${image_json}" | jq -s add > image-configured.json

# We do some extra handling of the rootfs here; it feeds into size estimation.
rootfs_type=$(jq -re .rootfs < image-configured.json)
rootfs_type=$(jq -re .rootfs < "${image_json}")

deploy_via_container=""
if jq -re '.["deploy-via-container"]' < image-configured.json; then
if jq -re '.["deploy-via-container"]' < "${image_json}"; then
deploy_via_container="true"
fi
container_imgref=$(jq -r '.["container-imgref"]//""' < image-configured.json)
container_imgref=$(jq -r '.["container-imgref"]//""' < "${image_json}")
# Nowadays we pull the container across 9p rather than accessing the repo, see
# https://github.com/openshift/os/issues/594
ostree_container=ostree-unverified-image:oci-archive:$builddir/$(meta_key images.ostree.path)
Expand Down Expand Up @@ -220,10 +216,10 @@ cat >image-dynamic.json << EOF
"ostree-container": "${ostree_container}"
}
EOF
cat image-configured.json image-dynamic.json | jq -s add > image.json
cat "${image_json}" image-dynamic.json | jq -s add > image-for-disk.json
runvm "${target_drive[@]}" -- \
/usr/lib/coreos-assembler/create_disk.sh \
--config "$(pwd)"/image.json \
--config "$(pwd)"/image-for-disk.json \
--kargs "\"${kargs}\"" \
"${disk_args[@]}"
/usr/lib/coreos-assembler/finalize-artifact "${path}.tmp" "${path}"
Expand Down
10 changes: 7 additions & 3 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,15 @@ prepare_build() {
flatten_image_yaml_to_file "${configdir}/image.yaml" "${image_yaml}"
# Convert the image.yaml to JSON so that it can be more easily parsed
# by the shell script in create_disk.sh.
image_json="${workdir}/tmp/image.json"
yaml2json "${image_yaml}" "${image_json}"
yaml2json "/usr/lib/coreos-assembler/image-default.yaml" image-default.json
# Combine with the defaults
yaml2json "${image_yaml}" repo-image.json
export image_json="${workdir}/tmp/image.json"
cat image-default.json repo-image.json | jq -s add > "${image_json}"
rm image-default.json repo-image.json

export workdir configdir manifest manifest_lock manifest_lock_overrides manifest_lock_arch_overrides
export fetch_stamp image_json
export fetch_stamp

if ! [ -f "${manifest}" ]; then
fatal "Failed to find ${manifest}"
Expand Down

0 comments on commit 4b61566

Please sign in to comment.