From 422681c076979d02c7b725756ddae26a87a37bad Mon Sep 17 00:00:00 2001 From: romang Date: Mon, 26 Nov 2018 10:34:39 +0100 Subject: [PATCH 1/4] Fix: convert deprecated labels to annotations Patch converts deprecated[0] labels to annotations conformant to OCI image specifications[1]. [0] - https://github.com/label-schema/label-schema.org#label-schemaorg [1] - https://github.com/opencontainers/image-spec/blob/master/annotations.md#annotations --- docker/containerbuild.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docker/containerbuild.sh b/docker/containerbuild.sh index edd6d2d..df570c1 100755 --- a/docker/containerbuild.sh +++ b/docker/containerbuild.sh @@ -14,7 +14,9 @@ USAGE="USAGE: $(basename "$0") kickstart" KICKSTART="$1" KSNAME=${KICKSTART%.*} -BUILDDATE=$(date +%Y%m%d) +DATETIME=$(date +%s) +BUILDDATE=$(date --utc --date="@$DATETIME" +%Y%m%d) +BUILDDATERFC3339=$(date --rfc-3339=seconds --utc --date="@$DATETIME") BUILDROOT=/var/tmp/containers/$BUILDDATE/$KSNAME CONT_ARCH=$(uname -m) @@ -67,11 +69,15 @@ cat << EOF > $BUILDROOT/docker/Dockerfile FROM scratch ADD $KSNAME-docker.tar.xz / -LABEL org.label-schema.schema-version="1.0" \\ - org.label-schema.name="CentOS Base Image" \\ - org.label-schema.vendor="CentOS" \\ - org.label-schema.license="GPLv2" \\ - org.label-schema.build-date="$BUILDDATE" +LABEL org.opencontainers.image.authors="centos-devel@centos.org, irc://#centos-devel@freenode" \\ + org.opencontainers.image.created="$BUILDDATERFC3339" \\ + org.opencontainers.image.url="https://www.centos.org" \\ + org.opencontainers.image.documentation="https://github.com/docker-library/docs/tree/master/centos" \\ + org.opencontainers.image.source="https://git.centos.org" \\ + org.opencontainers.image.vendor="The CentOS Project" \\ + org.opencontainers.image.licenses="GPL-2.0-only" \\ + org.opencontainers.image.title="CentOS Base Image" \\ + org.opencontainers.image.description="CentOS Base Image" CMD ["/bin/bash"] EOF From 1706e08272ee367ab4c8a587e90a154c47066dd5 Mon Sep 17 00:00:00 2001 From: romang Date: Mon, 26 Nov 2018 10:54:29 +0100 Subject: [PATCH 2/4] Fix: split dynamic label into separate layer Patch splits separate layer with the (dynamic) date/time when the image has been built, from other (static) labels. --- docker/containerbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/containerbuild.sh b/docker/containerbuild.sh index df570c1..64d4667 100755 --- a/docker/containerbuild.sh +++ b/docker/containerbuild.sh @@ -70,7 +70,6 @@ FROM scratch ADD $KSNAME-docker.tar.xz / LABEL org.opencontainers.image.authors="centos-devel@centos.org, irc://#centos-devel@freenode" \\ - org.opencontainers.image.created="$BUILDDATERFC3339" \\ org.opencontainers.image.url="https://www.centos.org" \\ org.opencontainers.image.documentation="https://github.com/docker-library/docs/tree/master/centos" \\ org.opencontainers.image.source="https://git.centos.org" \\ @@ -78,6 +77,7 @@ LABEL org.opencontainers.image.authors="centos-devel@centos.org, irc://#centos-d org.opencontainers.image.licenses="GPL-2.0-only" \\ org.opencontainers.image.title="CentOS Base Image" \\ org.opencontainers.image.description="CentOS Base Image" +LABEL org.opencontainers.image.created="$BUILDDATERFC3339" CMD ["/bin/bash"] EOF From 17c4669f62e6e69d0e8a5cf36f9c6e124218b17e Mon Sep 17 00:00:00 2001 From: romang Date: Wed, 6 Feb 2019 23:08:24 +0100 Subject: [PATCH 3/4] Added more details to the container labels --- docker/containerbuild.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docker/containerbuild.sh b/docker/containerbuild.sh index 64d4667..44300c9 100755 --- a/docker/containerbuild.sh +++ b/docker/containerbuild.sh @@ -19,6 +19,10 @@ BUILDDATE=$(date --utc --date="@$DATETIME" +%Y%m%d) BUILDDATERFC3339=$(date --rfc-3339=seconds --utc --date="@$DATETIME") BUILDROOT=/var/tmp/containers/$BUILDDATE/$KSNAME CONT_ARCH=$(uname -m) +ARCH="${KSNAME:8}" +[ -n "${ARCH}" ] && ARCHD="-${ARCH}" +RELEASEVER="${KSNAME:7:1}" +COMMIT="$(git rev-parse HEAD)" #### Test for script requirements # Did we get passed a kickstart @@ -69,13 +73,15 @@ cat << EOF > $BUILDROOT/docker/Dockerfile FROM scratch ADD $KSNAME-docker.tar.xz / -LABEL org.opencontainers.image.authors="centos-devel@centos.org, irc://#centos-devel@freenode" \\ +LABEL org.opencontainers.image.ref.name=centos-6-i386-20181201="centos-${RELEASEVER}${ARCHD}" \\ + org.opencontainers.image.authors="centos-devel@centos.org, irc://#centos-devel@freenode" \\ org.opencontainers.image.url="https://www.centos.org" \\ org.opencontainers.image.documentation="https://github.com/docker-library/docs/tree/master/centos" \\ - org.opencontainers.image.source="https://git.centos.org" \\ + org.opencontainers.image.source="https://github.com/CentOS/sig-cloud-instance-build.git" \\ + org.opencontainers.image.revision="${COMMIT}" \\ org.opencontainers.image.vendor="The CentOS Project" \\ org.opencontainers.image.licenses="GPL-2.0-only" \\ - org.opencontainers.image.title="CentOS Base Image" \\ + org.opencontainers.image.title="CentOS ${RELEASEVER} Base Image ${ARCH}" \\ org.opencontainers.image.description="CentOS Base Image" LABEL org.opencontainers.image.created="$BUILDDATERFC3339" From 3ccc7c93a583bb59dcb3706c6c426aa650a555f0 Mon Sep 17 00:00:00 2001 From: romang Date: Wed, 6 Feb 2019 23:15:16 +0100 Subject: [PATCH 4/4] Mistype fix in label --- docker/containerbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/containerbuild.sh b/docker/containerbuild.sh index 44300c9..a6bab9d 100755 --- a/docker/containerbuild.sh +++ b/docker/containerbuild.sh @@ -73,7 +73,7 @@ cat << EOF > $BUILDROOT/docker/Dockerfile FROM scratch ADD $KSNAME-docker.tar.xz / -LABEL org.opencontainers.image.ref.name=centos-6-i386-20181201="centos-${RELEASEVER}${ARCHD}" \\ +LABEL org.opencontainers.image.ref.name="centos-${RELEASEVER}${ARCHD}" \\ org.opencontainers.image.authors="centos-devel@centos.org, irc://#centos-devel@freenode" \\ org.opencontainers.image.url="https://www.centos.org" \\ org.opencontainers.image.documentation="https://github.com/docker-library/docs/tree/master/centos" \\