2020-09-17 15:35:39 +02:00
|
|
|
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
trap 'rm -rf ${tmpdir}' EXIT
|
|
|
|
|
|
|
|
script="$(realpath "$(dirname $0)")/docker_label_helper"
|
|
|
|
|
|
|
|
cd $tmpdir
|
|
|
|
|
2021-07-23 11:50:31 +02:00
|
|
|
# Test old syntax
|
2020-09-17 15:35:39 +02:00
|
|
|
cat >Dockerfile <<EOF
|
|
|
|
# labelprefix=org.opensuse.nano
|
|
|
|
PREFIXEDLABEL org.opencontainers.image.title="Example container"
|
|
|
|
PREFIXEDLABEL org.opencontainers.image.description="This contains nano"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
export BUILD_DIST=
|
|
|
|
sh "${script}"
|
|
|
|
|
|
|
|
diff -u Dockerfile - <<EOF
|
|
|
|
LABEL org.opensuse.nano.title="Example container"
|
|
|
|
LABEL org.opencontainers.image.title="Example container"
|
|
|
|
LABEL org.opensuse.nano.description="This contains nano"
|
|
|
|
LABEL org.opencontainers.image.description="This contains nano"
|
|
|
|
EOF
|
2021-07-23 11:50:31 +02:00
|
|
|
|
|
|
|
rm -f Dockerfile
|
|
|
|
|
|
|
|
# Test new syntax
|
|
|
|
cat >Dockerfile <<EOF
|
|
|
|
# labelprefix=org.opensuse.nano
|
|
|
|
LABEL org.opencontainers.image.title="Example container"
|
|
|
|
LABEL org.opencontainers.image.description="This contains nano"
|
|
|
|
# endlabelprefix
|
|
|
|
LABEL not.expanded.label="example"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
export BUILD_DIST=
|
|
|
|
sh "${script}"
|
|
|
|
|
|
|
|
diff -u Dockerfile - <<EOF
|
|
|
|
LABEL org.opensuse.nano.title="Example container"
|
|
|
|
LABEL org.opencontainers.image.title="Example container"
|
|
|
|
LABEL org.opensuse.nano.description="This contains nano"
|
|
|
|
LABEL org.opencontainers.image.description="This contains nano"
|
|
|
|
LABEL not.expanded.label="example"
|
|
|
|
EOF
|