Skip to content

Commit

Permalink
build: Add support for ostree-format: oci-chunked
Browse files Browse the repository at this point in the history
This *opts in* to using coreos/rpm-ostree#3478
so we can safely ratchet in the change, and more easily test in
in non-production CI configurations but still using coreos-assembler.
  • Loading branch information
cgwalters authored and jlebon committed Apr 1, 2022
1 parent 4b61566 commit 5d0dce0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -384,20 +384,21 @@ if [ "${commit}" == "${previous_commit}" ] && \
fi
else
ostree_format=$(jq -r '.["ostree-format"]' < "${image_json}")
ostree_tarfile_path="${name}-${buildid}-ostree.${basearch}.ociarchive"
gitsrc=$(jq -r .git.origin < "${PWD}/coreos-assembler-config-git.json")
cmd=(ostree container encapsulate)
case "${ostree_format}" in
null|oci)
ostree_tarfile_path="${name}-${buildid}-ostree.${basearch}.ociarchive"
gitsrc=$(jq -r .git.origin < "${PWD}/coreos-assembler-config-git.json")
runv ostree container encapsulate --repo="${tmprepo}" \
--label="coreos-assembler.image-config-checksum=${image_config_checksum}" \
--label="coreos-assembler.image-input-checksum=${image_input_checksum}" \
--label="org.opencontainers.image.source=${gitsrc}" \
--label="org.opencontainers.image.revision=${config_gitrev}" \
"${buildid}" \
oci-archive:"${ostree_tarfile_path}".tmp:latest
;;
oci) ;;
oci-chunked) cmd=(rpm-ostree container-encapsulate) ;;
*) fatal "Unknown ostree-format: ${ostree_format}"
esac
runv "${cmd[@]}" --repo="${tmprepo}" \
--label="coreos-assembler.image-config-checksum=${image_config_checksum}" \
--label="coreos-assembler.image-input-checksum=${image_input_checksum}" \
--label="org.opencontainers.image.source=${gitsrc}" \
--label="org.opencontainers.image.revision=${config_gitrev}" \
"${buildid}" \
oci-archive:"${ostree_tarfile_path}".tmp:latest
/usr/lib/coreos-assembler/finalize-artifact "${ostree_tarfile_path}"{.tmp,}
ostree_tarfile_sha256=$(sha256sum "${ostree_tarfile_path}" | awk '{print$1}')
fi
Expand Down
2 changes: 2 additions & 0 deletions src/image-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ rootfs: "xfs"
rootfs-args: ""
grub-script: "/usr/lib/coreos-assembler/grub.cfg"

# Can also be oci-chunked
ostree-format: oci
# True if we should use `ostree container image deploy`
deploy-via-container: false

Expand Down

0 comments on commit 5d0dce0

Please sign in to comment.