Commit 20238949 authored by Dominique Feyer's avatar Dominique Feyer

TASK: Adapt pipeline to support shell executor

parent 4aa4425a
Pipeline #889 failed with stages
in 2 seconds
image: docker:latest
variables:
DOCKER_DRIVER: overlay
services:
- docker:dind
stages:
- build
- push
- cleanup
before_script:
- docker info
- export APP_IMAGE="ttree/phpbu"
- export BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
- export VCS_REF=`git rev-parse --short HEAD`
- export ISOLATION=pipeline_${CI_PIPELINE_ID}
- export COMPOSE_PROJECT_NAME=${ISOLATION}
- pwd
- docker version
- docker-compose version
- echo "Start processing ${APP_VERSION} in ${ISOLATION}"
build:
stage: build
script:
- docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` -t ttree/phpbu:4.0.6 .
- docker tag ttree/phpbu:4.0.6 ttree/phpbu:4.0
- docker tag ttree/phpbu:4.0.6 ttree/phpbu:latest
- make build
push_app:
stage: push
script:
- docker login -u "${REGISTRY_USERNAME}" -p "${REGISTRY_PASSWORD}"
- docker tag ${ISOLATION}_app ${APP_IMAGE}:${CI_COMMIT_TAG}
- docker push ${APP_IMAGE}:${CI_COMMIT_TAG}
only:
- tags
cleanup:
stage: cleanup
when: always
script:
- make clean
- docker ps -f name=${ISOLATION}
build:
docker build -t ttree/phpbu:4.0.6 .
docker tag ttree/phpbu:4.0.6 ttree/phpbu:4.0
docker tag ttree/phpbu:4.0.6 ttree/phpbu:latest
push:
docker push ttree/phpbu:4.0.6
docker push ttree/phpbu:4.0
docker push ttree/phpbu:latest
include ./Makefile.base
DOCKER_COMPOSE ?= docker-compose
DOCKER_HOST ?= localhost
# Targets
# -------
default: help
build: ##@base build images in test-stack
$(shell echo $(shell git describe --long --tags --dirty --always) > ../src/version)
@echo $(shell cat ../src/version)
$(DOCKER_COMPOSE) build --pull
up: ##@base start stack
$(DOCKER_COMPOSE) up -d
clean: ##@base remove all containers in stack
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) rm -fv --all
$(DOCKER_COMPOSE) down --remove-orphans
# Help based on https://gist.github.com/prwhite/8168133 thanks to @nowox and @prwhite
# And add help text after each target name starting with '\#\#'
# A category can be added with @category
HELP_FUN = \
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([\w-]+)\s*:.*\#\#(?:@([\w-]+))?\s(.*)$$/ }; \
print "\nusage: make [target ...]\n\n"; \
for (keys %help) { \
print "$$_:\n"; \
for (@{$$help{$$_}}) { \
$$sep = "." x (25 - length $$_->[0]); \
print " $$_->[0]$$sep$$_->[1]\n"; \
} \
print "\n"; }
help: ##@system show this help
#
# General targets
#
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
version: "2"
services:
app:
build:
context: .
dockerfile: Dockerfile
args:
- BUILD_DATE=${BUILD_DATE}
- VCS_REF=${VCS_REF}
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