Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package obs-service-docker_label_helper for openSUSE:Factory checked in at 2024-06-10 17:38:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/obs-service-docker_label_helper (Old) and /work/SRC/openSUSE:Factory/.obs-service-docker_label_helper.new.19518 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "obs-service-docker_label_helper" Mon Jun 10 17:38:38 2024 rev:7 rq:1179700 version:0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/obs-service-docker_label_helper/obs-service-docker_label_helper.changes 2023-03-01 16:14:59.782892795 +0100 +++ /work/SRC/openSUSE:Factory/.obs-service-docker_label_helper.new.19518/obs-service-docker_label_helper.changes 2024-06-10 17:38:58.285923157 +0200 @@ -1,0 +2,5 @@ +Fri Jun 7 08:31:35 UTC 2024 - Andrea Mazzotti <andrea.mazzotti@suse.com> + +- Support Docker.FLAVOR in _multibuild (boo#1225985) + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ docker_label_helper ++++++ --- /var/tmp/diff_new_pack.X1TjxN/_old 2024-06-10 17:38:58.925946833 +0200 +++ /var/tmp/diff_new_pack.X1TjxN/_new 2024-06-10 17:38:58.929946980 +0200 @@ -1,6 +1,8 @@ #!/bin/bash set -eu +file="Dockerfile" + if [ "${BUILD_DIST+x}" != "x" ]; then echo "Not running in an OBS build container" exit 1 @@ -11,10 +13,10 @@ . "${BUILD_DATA}" # The build script renames the recipe (to strip _service:foo:), but doesn't update .data - RECIPEFILE="${RECIPEFILE##*:}" + file="${RECIPEFILE##*:}" - if [ "${RECIPEFILE}" != "Dockerfile" ]; then - echo "Recipe is not a Dockerfile - exiting" + if [[ ! "${file}" =~ ^Dockerfile.* ]]; then + echo "Recipe ${file} is not a Dockerfile - exiting" exit 0 fi fi @@ -24,5 +26,6 @@ match($0, /^# labelprefix=(.*)$/, m) { labelprefix=m[1]; next } labelprefix != "" && match($0, /^(PREFIXED)?LABEL[[:space:]]+[^=]*\.([^.=]*)=(.*)$/, m) { printf "LABEL %s.%s=%s\n", labelprefix, m[2], m[3]; gsub(/^PREFIXEDLABEL/, "LABEL") } match($0, /^# endlabelprefix/) { labelprefix=""; next } - 1' Dockerfile + 1' "${file}" +(No newline at EOF) ++++++ test.sh ++++++ --- /var/tmp/diff_new_pack.X1TjxN/_old 2024-06-10 17:38:58.969948460 +0200 +++ /var/tmp/diff_new_pack.X1TjxN/_new 2024-06-10 17:38:58.977948756 +0200 @@ -58,3 +58,42 @@ LABEL not.expanded.label="example" EOF +# Test _multibuild +cat >Dockerfile.FLAVOR <<EOF +# labelprefix=org.opensuse.nano +LABEL org.opencontainers.image.title="Example container." +# endlabelprefix +EOF + +export BUILD_DIST="$tmpdir/test_multibuild/.build/build.dist" +mkdir -p "$tmpdir/test_multibuild/.build" +cat >"$tmpdir/test_multibuild/.build/build.data" <<EOF +RECIPEFILE=_service:obs_scm:Dockerfile.FLAVOR +EOF +sh "${script}" + +diff -u Dockerfile.FLAVOR - <<EOF +LABEL org.opensuse.nano.title="Example container." +LABEL org.opencontainers.image.title="Example container." +EOF + +# Test _multibuild when not a Dockerfile.* +cat >NotADockerfile <<EOF +# labelprefix=org.opensuse.nano +LABEL org.opencontainers.image.title="Example container." +# endlabelprefix +EOF + +export BUILD_DIST="$tmpdir/test_multibuild/.build/build.dist" +mkdir -p "$tmpdir/test_multibuild/.build" +cat >"$tmpdir/test_multibuild/.build/build.data" <<EOF +RECIPEFILE=_service:obs_scm:NotADockerfile +EOF +sh "${script}" + +diff -u NotADockerfile - <<EOF +# labelprefix=org.opensuse.nano +LABEL org.opencontainers.image.title="Example container." +# endlabelprefix +EOF +