Skip to content

Commit

Permalink
create-disk: Handle layered container image deploys
Browse files Browse the repository at this point in the history
This requires ostreedev/ostree-rs-ext#275

When `deploy-via-container: true` is used in combination with
the new `rpm-ostree container-encapsulate` from
coreos/rpm-ostree#3478

We need to use the ostree-container synthetic merge commit to find
the deployment.

(Actually, what we want is something more like `ostree admin status --json`,
 or I guess for now `rpm-ostree status --json` to work offline; but
 for now this is good too)
  • Loading branch information
cgwalters authored and jlebon committed Apr 4, 2022
1 parent 093fb39 commit 7ed3dae
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ if test -n "${deploy_via_container}"; then
done
ostree container image deploy --imgref "${ostree_container}" \
${container_imgref:+--target-imgref $container_imgref} \
--write-commitid-to /tmp/commit.txt \
--stateroot "$os_name" --sysroot $rootfs $kargsargs
deploy_commit=$(cat /tmp/commit.txt)
rm /tmp/commit.txt
else
# Pull the commit
time ostree container unencapsulate --repo=$rootfs/ostree/repo "${ostree_container}"
Expand All @@ -288,11 +291,11 @@ else
kargsargs+="--karg-append=$karg "
done
ostree admin deploy "${deploy_ref}" --sysroot $rootfs --os "$os_name" $kargsargs
deploy_commit=$commit
fi
# Note that at the current time, this only supports deploying non-layered
# container images; xref https://github.com/ostreedev/ostree-rs-ext/issues/143
deploy_root="$rootfs/ostree/deploy/${os_name}/deploy/${commit}.0"
test -d "${deploy_root}"
# Sanity check
deploy_root="$rootfs/ostree/deploy/${os_name}/deploy/${deploy_commit}.0"
test -d "${deploy_root}" || (echo "failed to find $deploy_root"; exit 1)

# This will allow us to track the version that an install
# originally used; if we later need to understand something
Expand Down

0 comments on commit 7ed3dae

Please sign in to comment.