Merge "Fix: git commit id labels on images"

This commit is contained in:
Zuul 2018-09-28 14:15:35 +00:00 committed by Gerrit Code Review
commit 12d79ce423
4 changed files with 36 additions and 5 deletions

View File

@ -18,7 +18,7 @@ BUILD_CTX ?= src/bin
IMAGE_PREFIX ?= airshipit
IMAGE_TAG ?= untagged
IMAGE_NAME := airflow shipyard
LABEL ?= commit-id
COMMIT ?= commit-id
DOCKER_REGISTRY ?= quay.io
PUSH_IMAGE ?= false
@ -83,7 +83,11 @@ run:
.PHONY: build_airflow
build_airflow:
ifeq ($(USE_PROXY), true)
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
docker build --network host -t $(IMAGE) \
--label "org.opencontainers.image.revision=$(COMMIT)" \
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
-f $(IMAGE_DIR)/Dockerfile \
--build-arg FROM=$(UBUNTU_BASE_IMAGE) \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
@ -93,7 +97,11 @@ ifeq ($(USE_PROXY), true)
--build-arg NO_PROXY=$(NO_PROXY) \
--build-arg ctx_base=$(BUILD_CTX) .
else
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
docker build --network host -t $(IMAGE) \
--label "org.opencontainers.image.revision=$(COMMIT)" \
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
-f $(IMAGE_DIR)/Dockerfile \
--build-arg FROM=$(UBUNTU_BASE_IMAGE) \
--build-arg ctx_base=$(BUILD_CTX) .
endif
@ -104,7 +112,11 @@ endif
.PHONY: build_shipyard
build_shipyard:
ifeq ($(USE_PROXY), true)
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
docker build --network host -t $(IMAGE) \
--label "org.opencontainers.image.revision=$(COMMIT)" \
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
-f $(IMAGE_DIR)/Dockerfile \
--build-arg FROM=$(PYTHON_BASE_IMAGE) \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
@ -114,7 +126,11 @@ ifeq ($(USE_PROXY), true)
--build-arg NO_PROXY=$(NO_PROXY) \
--build-arg ctx_base=$(BUILD_CTX) .
else
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile \
docker build --network host -t $(IMAGE) \
--label "org.opencontainers.image.revision=$(COMMIT)" \
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
--label "org.opencontainers.image.title=$(IMAGE_NAME)" \
-f $(IMAGE_DIR)/Dockerfile \
--build-arg FROM=$(PYTHON_BASE_IMAGE) \
--build-arg ctx_base=$(BUILD_CTX) .
endif

View File

@ -16,6 +16,13 @@
ARG FROM=ubuntu:16.04
FROM ${FROM}
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-shipyard.readthedocs.org'
LABEL org.opencontainers.image.source='https://git.openstack.org/openstack/airship-shipyard'
LABEL org.opencontainers.image.vendor='The Airship Authors'
LABEL org.opencontainers.image.licenses='Apache-2.0'
# Do not prompt user for choices on installation/configuration of packages
# Set port 8080 for Airflow Web
# Set port 5555 for Airflow Flower

View File

@ -15,6 +15,13 @@
ARG FROM=python:3.5
FROM ${FROM}
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-shipyard.readthedocs.org'
LABEL org.opencontainers.image.source='https://git.openstack.org/openstack/airship-shipyard'
LABEL org.opencontainers.image.vendor='The Airship Authors'
LABEL org.opencontainers.image.licenses='Apache-2.0'
ENV container docker
ENV PORT 9000
ENV LC_ALL C.UTF-8

View File

@ -109,6 +109,7 @@
DOCKER_REGISTRY: "quay.io"
IMAGE_PREFIX: "airshipit"
IMAGE_TAG: "{{ item }}"
COMMIT: "{{ zuul.newrev }}"
PUSH_IMAGE: "true"
with_items: "{{ image_tags.stdout_lines }}"