Support pegleg to run on opensuse leap15 image

Add DISTRO parameter to support multiple distros
Add Dockerfile for opensuse to build leap 15 image.

Change-Id: I7a529476937494e042a4801117489325aa6621c7
This commit is contained in:
Rajeshwari Dharwadkar 2019-02-26 20:04:59 -08:00 committed by Arun Kant
parent 498d5c078f
commit 6ee2aaf845
8 changed files with 109 additions and 15 deletions

View File

@ -20,15 +20,18 @@
jobs:
- openstack-tox-pep8
- airship-pegleg-doc-build
- airship-pegleg-docker-build-gate
- airship-pegleg-docker-build-gate-ubuntu
- airship-pegleg-docker-build-gate-opensuse
gate:
jobs:
- openstack-tox-pep8
- airship-pegleg-doc-build
- airship-pegleg-docker-build-gate
- airship-pegleg-docker-build-gate-ubuntu
- airship-pegleg-docker-build-gate-opensuse
post:
jobs:
- airship-pegleg-docker-publish
- airship-pegleg-docker-publish-ubuntu
- airship-pegleg-docker-publish-opensuse
- nodeset:
name: airship-pegleg-single-node
@ -48,7 +51,7 @@
- ^setup.cfg$
- job:
name: airship-pegleg-docker-build-gate
name: airship-pegleg-docker-build-gate-ubuntu
timeout: 1800
run: tools/gate/playbooks/docker-image-build.yaml
nodeset: airship-pegleg-single-node
@ -56,12 +59,27 @@
- '^doc/.*'
vars:
publish: false
distro: ubuntu_xenial
tags:
dynamic:
patch_set: true
- job:
name: airship-pegleg-docker-publish
name: airship-pegleg-docker-build-gate-opensuse
timeout: 1800
run: tools/gate/playbooks/docker-image-build.yaml
nodeset: airship-pegleg-single-node
irrelevant-files:
- '^doc/.*'
vars:
publish: false
distro: opensuse_15
tags:
dynamic:
patch_set: true
- job:
name: airship-pegleg-docker-publish-ubuntu
timeout: 1800
run: tools/gate/playbooks/docker-image-build.yaml
nodeset: airship-pegleg-single-node
@ -71,6 +89,26 @@
- '^doc/.*'
vars:
publish: true
distro: ubuntu_xenial
tags:
dynamic:
branch: true
commit: true
static:
- latest
- job:
name: airship-pegleg-docker-publish-opensuse
timeout: 1800
run: tools/gate/playbooks/docker-image-build.yaml
nodeset: airship-pegleg-single-node
secrets:
- airship_pegleg_quay_creds
irrelevant-files:
- '^doc/.*'
vars:
publish: true
distro: opensuse_15
tags:
dynamic:
branch: true

View File

@ -25,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
@ -62,6 +65,8 @@ lint: py_lint
.PHONY: format
format: py_format
_BASE_IMAGE_ARG := $(if $(BASE_IMAGE),--build-arg FROM="${BASE_IMAGE}" ,)
.PHONY: build_pegleg
build_pegleg:
ifeq ($(USE_PROXY), true)
@ -69,8 +74,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/pegleg/Dockerfile \
--build-arg FROM=$(PYTHON_BASE_IMAGE) \
-f images/pegleg/Dockerfile.$(DISTRO) \
$(_BASE_IMAGE_ARG) \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
--build-arg HTTP_PROXY=$(PROXY) \
@ -83,8 +88,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/pegleg/Dockerfile \
--build-arg FROM=$(PYTHON_BASE_IMAGE) \
-f images/pegleg/Dockerfile.$(DISTRO) \
$(_BASE_IMAGE_ARG) \
--build-arg ctx_base=$(PEGLEG_BUILD_CTX) .
endif
ifeq ($(PUSH_IMAGE), true)

View File

@ -41,7 +41,7 @@ Environment Variables
$IMAGE = Location of pegleg docker image.
Example: $IMAGE=quay.io/airshipit/pegleg:latest
Example: $IMAGE=quay.io/airshipit/pegleg:latest-ubuntu_xenial
Usage
=====

View File

@ -77,9 +77,10 @@ The Pegleg code base lives under ``pegleg``. Pegleg supports py36 interpreter.
Docker
------
The Pegleg Dockerfile is located in ``/images/pegleg`` along with any
artifacts built specifically to enable the container image. Make targets are
used for generating and testing the artifacts.
Pegleg Dockerfiles for supported distributions are located in
``/images/pegleg`` along with any artifacts built specifically to enable the
container image. Make targets are used for generating and testing the
artifacts.
* ``make images`` - Build the Pegleg Docker image.

View File

@ -0,0 +1,46 @@
ARG FROM=opensuse/leap:15.0
FROM ${FROM}
ARG CFSSLURL=https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
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-pegleg.readthedocs.org'
LABEL org.opencontainers.image.source='https://opendev.org/airship/pegleg'
LABEL org.opencontainers.image.vendor='The Airship Authors'
LABEL org.opencontainers.image.licenses='Apache-2.0'
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN set -x && \
zypper up -y && \
zypper --non-interactive install \
git-core \
which \
gcc \
curl \
python3-devel \
python3-setuptools \
python3-dbm \
python3-pip && \
pip install --upgrade pip && \
zypper clean -a && \
rm -rf \
/tmp/* \
/var/tmp/* \
/var/log/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
VOLUME /var/pegleg
WORKDIR /var/pegleg
COPY requirements.txt /opt/pegleg/requirements.txt
RUN pip3 install --no-cache-dir -r /opt/pegleg/requirements.txt
COPY tools/install-cfssl.sh /opt/pegleg/tools/install-cfssl.sh
RUN /opt/pegleg/tools/install-cfssl.sh ${CFSSLURL}
COPY . /opt/pegleg
RUN pip3 install -e /opt/pegleg

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/pegleg:latest}
: ${IMAGE:=quay.io/airshipit/pegleg:latest-ubuntu_xenial}
: ${TERM_OPTS:=-it}