Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/cmd-buildextend-metal
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,14 @@ 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)

deploy_container=
container_imgref=$(jq -r '.["container-imgref"]//""' < image-configured.json)
if test -n "${container_imgref}" || jq -re '.["deploy-via-container"]' < image-configured.json >/dev/null; then
deploy_container=ostree-unverified-image:oci-archive:$builddir/$(meta_key images.ostree.path)
deploy_via_container=""
if jq -re '.["deploy-via-container"]' < image-configured.json; then
deploy_via_container="true"
fi
container_imgref=$(jq -r '.["container-imgref"]//""' < image-configured.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)

# fs-verity requires block size = page size. We need to take that into account
# in the disk size estimation due to higher fragmentation on larger blocks.
Expand Down Expand Up @@ -210,11 +213,11 @@ cat >image-dynamic.json << EOF
"osname": "${name}",
"buildid": "${build}",
"imgid": "${img}",
"deploy-container": "${deploy_container}",
"deploy-via-container": "${deploy_via_container}",
"container-imgref": "${container_imgref}",
"ostree-commit": "${commit}",
"ostree-ref": "${ref}",
"ostree-repo": "${ostree_repo}"
"ostree-container": "${ostree_container}"
}
EOF
cat image-configured.json image-dynamic.json | jq -s add > image.json
Expand Down
10 changes: 5 additions & 5 deletions src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ esac

bootfs=$(getconfig "bootfs")
grub_script=$(getconfig "grub-script")
ostree=$(getconfig "ostree-repo")
ostree_container=$(getconfig "ostree-container")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another angle to look at this from is that we are dropping another dependency in the code on an unpacked ostree repository, moving to where "source of truth" is a container image (that has an ostree commit inside still).

commit=$(getconfig "ostree-commit")
ref=$(getconfig "ostree-ref")
# We support not setting a remote name (used by RHCOS)
remote_name=$(getconfig_def "ostree-remote" "")
deploy_container=$(getconfig "deploy-container" "")
deploy_via_container=$(getconfig "deploy-via-container" "")
container_imgref=$(getconfig "container-imgref" "")
os_name=$(getconfig "osname")
rootfs_size=$(getconfig "rootfs-size")
Expand Down Expand Up @@ -262,18 +262,18 @@ fi
# *not* the shell here. Hence the backslash escape.
allkargs="$extrakargs \$ignition_firstboot"

if test -n "${deploy_container}"; then
if test -n "${deploy_via_container}"; then
kargsargs=""
for karg in $allkargs
do
kargsargs+="--karg=$karg "
done
ostree container image deploy --imgref "${deploy_container}" \
ostree container image deploy --imgref "${ostree_container}" \
${container_imgref:+--target-imgref $container_imgref} \
--stateroot "$os_name" --sysroot $rootfs $kargsargs
else
# Pull the commit
time ostree pull-local --repo $rootfs/ostree/repo "$ostree" "$commit"
time ostree container unencapsulate --repo=$rootfs/ostree/repo "${ostree_container}"
# Deploy it, using an optional remote prefix
if test -n "${remote_name}"; then
deploy_ref="${remote_name}:${ref}"
Expand Down