danhuawang commented on code in PR #13611:
URL: https://github.com/apache/gravitino/pull/13611#discussion_r4628206108
##########
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:
Fixed in 292f97966:
- Store OCI labels in a Bash array and expand with `"${oci_labels[@]}"` in
all four `docker buildx build` branches.
- Added `dev/docker/test-oci-labels.sh` to assert a whitespace-containing
`OCI_IMAGE_VERSION` (e.g. `2.0 custom`) stays 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]