diff --git a/Makefile b/Makefile index 0162f682..1f030fb9 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,10 @@ ifeq ($(IMAGE_NAME), calicoctl-utility) IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${CALICOCTL_VERSION}-${IMAGE_TAG} endif +ifeq ($(IMAGE_NAME), ospurge) + IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} +endif + # Build Docker image for this project .PHONY: images images: build_$(IMAGE_NAME) @@ -72,6 +76,12 @@ else ifeq ($(OS_RELEASE), alpine) $(EXTRA_BUILD_ARGS) \ -t $(IMAGE) \ . +else ifeq ($(OS_RELEASE), ubuntu_bionic) + docker build -f $(IMAGE_NAME)/Dockerfile.$(OS_RELEASE) \ + --network host \ + $(EXTRA_BUILD_ARGS) \ + -t $(IMAGE) \ + . else docker build -t $(IMAGE) --network=host $(EXTRA_BUILD_ARGS) -f $(IMAGE_NAME)/Dockerfile.simple \ . diff --git a/README_MAKEFILE b/README_MAKEFILE index 2e6b88c5..32ca320d 100644 --- a/README_MAKEFILE +++ b/README_MAKEFILE @@ -14,4 +14,6 @@ eg: make IMAGE_NAME=calicoctl-utility OS_RELEASE=alpine + make IMAGE_NAME=ospurge OS_RELEASE=ubuntu_bionic + Note: calicoctl-utlity image only supports alpine OS. diff --git a/doc/source/ospurge.rst b/doc/source/ospurge.rst new file mode 100644 index 00000000..734abbce --- /dev/null +++ b/doc/source/ospurge.rst @@ -0,0 +1,20 @@ +================================= +ospurge container image +================================= + +This container builds a small image with ospurge service and +python-openstackclient utilities for use by the operator. + +Manual build +============ + +Here are the instructions for building the image: + +.. literalinclude:: ../../ospurge/build.sh + :language: shell + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./ospurge/build.sh diff --git a/ospurge/Dockerfile.ubuntu_bionic b/ospurge/Dockerfile.ubuntu_bionic new file mode 100644 index 00000000..f9888618 --- /dev/null +++ b/ospurge/Dockerfile.ubuntu_bionic @@ -0,0 +1,20 @@ +ARG FROM=docker.io/ubuntu:bionic +FROM ${FROM} + +LABEL org.opencontainers.image.authors='Openstack-Helm Authors' +LABEL org.opencontainers.image.url='https://git.openstack.com/openstack/openstack-helm-images' +LABEL org.opencontainers.image.documentation='https://git.openstack.com/openstack/openstack-helm-images/blob/master/README_MAKEFILE' +LABEL org.opencontainers.image.source='https://git.openstack.com/openstack/openstack-helm-images' +LABEL org.opencontainers.image.vendor='Openstack-Helm Authors' +LABEL org.opencontainers.image.licenses='BSD-3-Clause' + +RUN set -xe \ + && apt-get update && apt-get dist-upgrade -y \ + && apt-get install python3 -y \ + && apt-get install python3-pip -y + +RUN pip3 install ospurge \ + && pip3 install python-openstackclient + +WORKDIR /tmp +ENTRYPOINT ["/bin/sh", "-c"] diff --git a/ospurge/build.sh b/ospurge/build.sh new file mode 100755 index 00000000..4c1613ba --- /dev/null +++ b/ospurge/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash +SCRIPT=`realpath $0` +SCRIPT_DIR=`dirname ${SCRIPT}` +## Only build from main folder +cd ${SCRIPT_DIR}/.. + +IMAGE="ospurge" +VERSION=${VERSION:-latest} +DISTRO=${DISTRO:-ubuntu_bionic} +REGISTRY_URI=${REGISTRY_URI:-"openstackhelm/"} +EXTRA_TAG_INFO=${EXTRA_TAG_INFO:-""} +docker build -f ${IMAGE}/Dockerfile.${DISTRO} --network=host -t ${REGISTRY_URI}${IMAGE}:${VERSION}-${DISTRO}${EXTRA_TAG_INFO} ${extra_build_args} ${IMAGE} + +cd - diff --git a/zuul.d/ospurge.yaml b/zuul.d/ospurge.yaml new file mode 100644 index 00000000..5fc2ccff --- /dev/null +++ b/zuul.d/ospurge.yaml @@ -0,0 +1,59 @@ +--- +# Copyright 2019, AT&T Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- project: + check: + jobs: + - openstack-helm-images-build-ospurge + gate: + jobs: + - openstack-helm-images-upload-ospurge + promote: + jobs: + - openstack-helm-images-promote-ospurge + periodic: + jobs: + - openstack-helm-images-build-ospurge + +- job: + name: openstack-helm-images-build-ospurge + parent: openstack-helm-images-build + description: Build ospurge images + vars: &ospurge_vars + currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}" + docker_images: + - context: ospurge + repository: openstackhelm/ospurge + dockerfile: Dockerfile.ubuntu_bionic + tags: + - latest + - "{{ currentdate }}" + files: &ospurge_files + - ospurge/.* + - zuul.d/ospurge.yaml + +- job: + name: openstack-helm-images-upload-ospurge + parent: openstack-helm-images-upload + description: Build and upload ospurge images + vars: *ospurge_vars + files: *ospurge_files + +- job: + name: openstack-helm-images-promote-ospurge + parent: openstack-helm-images-promote + description: Promote a previously published ospurge image to latest. + vars: *ospurge_vars + files: *ospurge_files