Multi multi distro support images

This patch:
1. Resolves an issue where the base image was overrided with python:3.6
2. Adds framework for creating new images of other distributions and
   gating against them.

Change-Id: Iaa8ec86f947189bf24d40e5594e015554f7abddb
This commit is contained in:
Hughes, Alexander (ah8742) 2019-06-07 14:01:35 +00:00
parent 6d72d7f9fc
commit 6cfe98e0c3
5 changed files with 36 additions and 24 deletions

View File

@ -18,15 +18,15 @@
check:
jobs:
- openstack-tox-pep8
- spyglass-docker-build-gate
- spyglass-docker-build-gate-ubuntu_xenial
gate:
jobs:
- openstack-tox-pep8
- spyglass-docker-build-gate
- spyglass-docker-build-gate-ubuntu_xenial
post:
jobs:
- spyglass-docker-publish
- spyglass-upload-git-mirror
- spyglass-docker-publish-ubuntu_xenial
- nodeset:
name: spyglass-single-node
@ -35,25 +35,27 @@
label: ubuntu-xenial
- job:
name: spyglass-docker-build-gate
name: spyglass-docker-build-gate-ubuntu_xenial
timeout: 1800
run: tools/gate/playbooks/docker-image-build.yaml
nodeset: spyglass-single-node
vars:
publish: false
distro: ubuntu_xenial
tags:
dynamic:
patch_set: true
- job:
name: spyglass-docker-publish
name: spyglass-docker-publish-ubuntu_xenial
timeout: 1800
run: tools/gate/playbooks/docker-image-build.yaml
nodeset: armada-single-node
nodeset: spyglass-single-node
secrets:
- airship_spyglass_quay_creds
vars:
publish: true
distro: ubuntu_xenial
tags:
dynamic:
branch: true

View File

@ -12,11 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
SPYGLASS_BUILD_CTX ?= .
SPYGLASS_BUILD_CTX ?= spyglass
IMAGE_NAME ?= spyglass
IMAGE_PREFIX ?= airshipit
DOCKER_REGISTRY ?= quay.io
IMAGE_TAG ?= latest
HELM ?= helm
PROXY ?= http://proxy.foo.com:8000
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
USE_PROXY ?= false
@ -24,8 +25,11 @@ PUSH_IMAGE ?= false
# use this variable for image labels added in internal build process
LABEL ?= org.airshipit.build=community
COMMIT ?= $(shell git rev-parse HEAD)
IMAGE ?= $(DOCKER_REGISTRY)/$(IMAGE_PREFIX)/$(IMAGE_NAME):$(IMAGE_TAG)
DISTRO ?= ubuntu_xenial
IMAGE ?= $(DOCKER_REGISTRY)/$(IMAGE_PREFIX)/$(IMAGE_NAME):$(IMAGE_TAG)-${DISTRO}
PYTHON_BASE_IMAGE ?= python:3.6
BASE_IMAGE ?=
export
# Build all docker images for this project
@ -55,6 +59,8 @@ lint: py_lint
.PHONY: format
format: py_format
_BASE_IMAGE_ARG := $(if $(BASE_IMAGE),--build-arg FROM="${BASE_IMAGE}" ,)
.PHONY: build_spyglass
build_spyglass:
ifeq ($(USE_PROXY), true)
@ -62,8 +68,8 @@ ifeq ($(USE_PROXY), true)
--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 images/spyglass/Dockerfile \
--build-arg FROM=$(PYTHON_BASE_IMAGE) \
-f images/spyglass/Dockerfile.$(DISTRO) \
$(_BASE_IMAGE_ARG) \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
--build-arg HTTP_PROXY=$(PROXY) \
@ -76,8 +82,8 @@ else
--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 images/spyglass/Dockerfile \
--build-arg FROM=$(PYTHON_BASE_IMAGE) \
-f images/spyglass/Dockerfile.$(DISTRO) \
$(_BASE_IMAGE_ARG) \
--build-arg ctx_base=$(SPYGLASS_BUILD_CTX) .
endif
ifeq ($(PUSH_IMAGE), true)

View File

@ -22,6 +22,8 @@
var: publish
- debug:
var: tags
- debug:
var: distro
- debug:
var: zuul
- debug:
@ -91,6 +93,7 @@
chdir: "{{ zuul.project.src_dir }}"
target: images
params:
DISTRO: "{{ distro }}"
IMAGE_TAG: "{{ item }}"
with_items: "{{ image_tags.stdout_lines }}"
@ -115,6 +118,7 @@
params:
DOCKER_REGISTRY: "quay.io"
IMAGE_PREFIX: "airshipit"
DISTRO: "{{ distro }}"
IMAGE_TAG: "{{ item }}"
COMMIT: "{{ zuul.newrev | default('') }}"
PUSH_IMAGE: "true"

View File

@ -3,7 +3,7 @@
set -e
: ${WORKSPACE:=$(pwd)}
: ${IMAGE:=quay.io/airshipit/spyglass:latest}
: ${IMAGE:=quay.io/airshipit/spyglass:latest-ubuntu_xenial}
: ${TERM_OPTS:=-t}