porthole/Makefile
Roman Gorshunov 33ce528756 Image builds and publishing, CI gates
This patch set removes porthole-images-build and porthole-images-upload
zuul jobs, as they seem to be not used. Parent job upload-docker-image
currently does not support quay.io registry.

Add Zuul jobs to build and upload to quay.io mysqlclient-utility container
image, basing on other Airship project jobs.

Change Dockerfile of mysqlclient-utility to make it more consistent with
other Airship Dockerfiles.

Removed mysqlclient-utility/build.sh, as this seem not to be used.

Rewrite Makefile to support build-image-$(IMAGE_NAME) target, which
should be used to build images from different directories and allows to
base them on different base image.

Remove Makefile targets (pull-all-images, pull-images, dev-deploy) which
could not be executed anyway, because of absence of scripts they refer to.
Remove other unused Makefile targets.

Adjust copyright (license) message in files which are largely sourced
from Airship Apache 2.0 code.

Removed calicoctl, ceph, compute and openstack -utility jobs, as this
jobs only do linting of the same code multiple time, burdening OpenStack
Infrastructure. Added one linting job which runs agains complete code base.

Removed unused helm_install.sh, helm_tk.sh and
install_*_utility.sh scripts.

Change-Id: I2d8f4b0cfaa6a8def0539ce6c40cc3c320f36a7d
2019-09-25 18:39:11 +02:00

101 lines
3.5 KiB
Makefile

# Copyright 2019 AT&T Intellectual Property. All other rights reserved.
#
# 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
#
# https://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.
# It's necessary to set this because some environments don't link sh -> bash.
SHELL := /bin/bash
# APP INFO
DOCKER_REGISTRY ?= quay.io
IMAGE_PREFIX ?= airshipit
IMAGE_NAME ?=
IMAGE_TAG ?= latest
PROXY ?= http://proxy.foo.com:8000
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
USE_PROXY ?= false
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)
DISTRO_SUFFIX ?= $(DISTRO)
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO_SUFFIX}
BASE_IMAGE ?=
# VERSION INFO
GIT_COMMIT = ${COMMIT}
GIT_SHA = $(shell git rev-parse --short HEAD)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
ifdef VERSION
DOCKER_VERSION = $(VERSION)
endif
ifeq "$(DISTRO_SUFFIX)" ""
DOCKERFILE = "Dockerfiles/$(IMAGE_NAME)/Dockerfile"
else
DOCKERFILE = "Dockerfiles/$(IMAGE_NAME)/Dockerfile.$(DISTRO_SUFFIX)"
endif
info:
@echo "Version: ${VERSION}"
@echo "Git Tag: ${GIT_TAG}"
@echo "Git Commit: ${GIT_COMMIT}"
@echo "Git Tree State: ${GIT_DIRTY}"
@echo "Docker Version: ${DOCKER_VERSION}"
@echo "Registry: ${DOCKER_REGISTRY}"
all:
@echo "And what is there's nothing in there? You die, and there's" \
"nothing beyond that. Nothing. Nothing remains. Someone might" \
"remember you for a little while after but not for long.">&2; exit 2
check-docker:
@if [ -z $$(which docker) ]; then \
echo "Missing \`docker\` client which is required for development"; \
exit 2; \
fi
_BASE_IMAGE_ARG := $(if $(BASE_IMAGE),--build-arg FROM="${BASE_IMAGE}" ,)
build-image-$(IMAGE_NAME): check-docker
ifeq "$(IMAGE_NAME)" ""
@echo "Missing \`IMAGE_NAME\` variable." >&2; exit 2
endif
ifeq ($(USE_PROXY), true)
docker build --network host -t $(IMAGE) --label $(LABEL) \
--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 $(DOCKERFILE) \
$(_BASE_IMAGE_ARG) \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
--build-arg HTTP_PROXY=$(PROXY) \
--build-arg HTTPS_PROXY=$(PROXY) \
--build-arg no_proxy=$(NO_PROXY) \
--build-arg NO_PROXY=$(NO_PROXY) .
else
docker build --network host -t $(IMAGE) --label $(LABEL) \
--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 $(DOCKERFILE) \
$(_BASE_IMAGE_ARG) .
endif
ifeq ($(PUSH_IMAGE), true)
docker push $(IMAGE)
endif
.PHONY: all build-image-$(IMAGE_NAME) build-image-% check-docker info