Fix: git commit id labels on images
1) Use OCI Image Specs for labels instead of custom 'commit-id=xxxxx' or legacy "Label Schema" 2) Fix missing git commit id labels on images (.revision) 3) Add human-readable title (.title) of the image, URL (.url), and a few other properties (annotations) according to the latest Specs Change-Id: I78ae651cdcba69e3a9a7a27bafa9a3a13c8eb557
This commit is contained in:
parent
d3eee98e98
commit
34f7d760e8
2
Makefile
2
Makefile
@ -22,7 +22,7 @@ PROXY ?= http://proxy.foo.com:8000
|
|||||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||||
USE_PROXY ?= false
|
USE_PROXY ?= false
|
||||||
PUSH_IMAGE ?= false
|
PUSH_IMAGE ?= false
|
||||||
LABEL ?= commit-id
|
COMMIT ?= commit-id
|
||||||
IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||||
GO_BUILDER ?= docker.io/golang:1.10-stretch
|
GO_BUILDER ?= docker.io/golang:1.10-stretch
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode'
|
||||||
|
LABEL org.opencontainers.image.url='https://airshipit.org'
|
||||||
|
LABEL org.opencontainers.image.documentation='https://airship-drydock.readthedocs.org'
|
||||||
|
LABEL org.opencontainers.image.source='https://git.openstack.org/openstack/airship-drydock'
|
||||||
|
LABEL org.opencontainers.image.vendor='The Airship Authors'
|
||||||
|
LABEL org.opencontainers.image.licenses='Apache-2.0'
|
||||||
|
|
||||||
ARG UBUNTU_REPO=http://archive.ubuntu.com/ubuntu
|
ARG UBUNTU_REPO=http://archive.ubuntu.com/ubuntu
|
||||||
ARG TRUSTED_UBUNTU_REPO=no
|
ARG TRUSTED_UBUNTU_REPO=no
|
||||||
ARG ALLOW_UNAUTHENTICATED=false
|
ARG ALLOW_UNAUTHENTICATED=false
|
||||||
|
@ -22,7 +22,11 @@ then
|
|||||||
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS}| --build-arg PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}"
|
ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS}| --build-arg PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker build --network host -t ${IMAGE} --label ${LABEL} -f images/drydock/Dockerfile \
|
docker build --network host -t ${IMAGE} \
|
||||||
|
--label org.opencontainers.image.revision=${COMMIT} \
|
||||||
|
--label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \
|
||||||
|
--label org.opencontainers.image.title=${IMAGE_NAME} \
|
||||||
|
-f images/drydock/Dockerfile \
|
||||||
${ADDL_BUILD_ARGS} \
|
${ADDL_BUILD_ARGS} \
|
||||||
--build-arg BUILD_DIR=${BUILD_DIR} \
|
--build-arg BUILD_DIR=${BUILD_DIR} \
|
||||||
--build-arg http_proxy=${http_proxy} \
|
--build-arg http_proxy=${http_proxy} \
|
||||||
@ -31,4 +35,3 @@ docker build --network host -t ${IMAGE} --label ${LABEL} -f images/drydock/Docke
|
|||||||
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
|
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
|
||||||
--build-arg no_proxy=${no_proxy} \
|
--build-arg no_proxy=${no_proxy} \
|
||||||
--build-arg NO_PROXY=${NO_PROXY} .
|
--build-arg NO_PROXY=${NO_PROXY} .
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
DOCKER_REGISTRY: "quay.io"
|
DOCKER_REGISTRY: "quay.io"
|
||||||
IMAGE_PREFIX: "airshipit"
|
IMAGE_PREFIX: "airshipit"
|
||||||
IMAGE_TAG: "{{ item }}"
|
IMAGE_TAG: "{{ item }}"
|
||||||
|
COMMIT: "{{ zuul.newrev }}"
|
||||||
PUSH_IMAGE: "true"
|
PUSH_IMAGE: "true"
|
||||||
with_items: "{{ image_tags.stdout_lines }}"
|
with_items: "{{ image_tags.stdout_lines }}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user