Commit d9f2b997 authored by Markus Frosch's avatar Markus Frosch 📣
Browse files

Improve Makefile variables for GitLab and set defaults

parent 204d0491
......@@ -5,10 +5,6 @@ image: docker:latest
services:
- docker:dind
variables:
DOCKER_REGISTRY: ${CI_REGISTRY}
DOCKER_IMAGE_PREFIX: ${CI_PROJECT_PATH}/
before_script:
- docker info
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
......
IMAGE_PREFIX := ${DOCKER_IMAGE_PREFIX}
ifeq ($(IMAGE_PREFIX),)
IMAGE_PREFIX := icinga/raspbian-base/
ifndef CI_REGISTRY
CI_REGISTRY := registry.icinga.com
endif
REGISTRY := ${DOCKER_REGISTRY}
ifneq ($(REGISTRY),)
IMAGE_PREFIX := $(REGISTRY)/$(IMAGE_PREFIX)
ifeq ($(CI_PROJECT_PATH),)
CI_PROJECT_PATH := build-docker/raspbian-base
endif
ifeq ($(CI_COMMIT_REF_NAME),)
CI_COMMIT_REF_NAME := $(shell git rev-parse --abbrev-ref HEAD)
endif
IMAGE := $(CI_PROJECT_PATH)/${CI_COMMIT_REF_NAME}
IMAGE := $(IMAGE_PREFIX)${CI_COMMIT_REF_NAME}
ifneq ($(CI_REGISTRY),)
IMAGE := $(CI_REGISTRY)/$(IMAGE)
endif
.PHONY: all tarball clean
......
......@@ -3,13 +3,17 @@
DIST=jessie
GPGKEY=A0DA38D0D76E8B5D638872819165938D90FDDD2E
if [ -n "$DOCKER_IMAGE_PREFIX" ]; then
IMAGE="${DOCKER_IMAGE_PREFIX}debootstrap"
else
IMAGE=icinga/raspbian-base/debootstrap
if [ -z ${CI_REGISTRY+x} ]; then
CI_REGISTRY=registry.icinga.com
fi
if [ -n "$DOCKER_REGISTRY" ]; then
IMAGE="${DOCKER_REGISTRY}/${IMAGE}"
if [ -z "$CI_PROJECT_PATH" ]; then
CI_PROJECT_PATH=build-docker/raspbian-base
fi
IMAGE="${CI_PROJECT_PATH}/debootstrap"
if [ -n "${CI_REGISTRY}" ]; then
IMAGE="${CI_REGISTRY}/${IMAGE}"
fi
opts=
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment