jerryshao commented on code in PR #13611:
URL: https://github.com/apache/gravitino/pull/13611#discussion_r4627947439
##########
dev/docker/build-docker.sh:
##########
@@ -144,6 +144,22 @@ fi
build_args="${build_args} --build-arg IMAGE_NAME=${image_name} --build-arg
TAG_NAME=${tag_name}"
+# Standard OCI labels so a published image points at the commit it was built
+# from. Callers may set OCI_IMAGE_VERSION, OCI_IMAGE_REVISION, and
+# OCI_IMAGE_SOURCE. When unset, version is the image tag, revision is this
+# checkout, and source is apache/gravitino.
+oci_version="${OCI_IMAGE_VERSION:-${tag_name:-}}"
+oci_revision="${OCI_IMAGE_REVISION:-}"
+if [ -z "${oci_revision}" ]; then
+ oci_revision="$(git -C "${script_dir}" rev-parse HEAD 2>/dev/null || true)"
+fi
+oci_source="${OCI_IMAGE_SOURCE:-https://github.com/apache/gravitino}"
+oci_labels=""
+if [ -n "${oci_version}" ] && [ -n "${oci_revision}" ]; then
+ oci_labels="--label org.opencontainers.image.version=${oci_version} --label
org.opencontainers.image.revision=${oci_revision} --label
org.opencontainers.image.source=${oci_source}"
Review Comment:
[P2] Setting OCI_IMAGE_VERSION='2.0 custom' splits the label into
`org.opencontainers.image.version=2.0` and a separate `custom` argument when
`${oci_labels}` is expanded, causing buildx to receive an extra positional
argument. Please store the label options in a Bash array and expand it with
`"${oci_labels[@]}"` in all four build branches. Add a regression check that a
whitespace-containing override remains one label argument.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]