docker: multi tag builds
This commit is contained in:
parent
8a9d2ee0be
commit
f3aa081510
@ -1,43 +1,14 @@
|
|||||||
include:
|
default:
|
||||||
#- local: 'ci_templates/.cic-template.yml' #kaniko build templates
|
image: docker:latest
|
||||||
# these includes are app specific unit tests
|
tags:
|
||||||
- local: 'apps/cic-eth/.gitlab-ci.yml'
|
- cic-runner
|
||||||
- local: 'apps/cic-ussd/.gitlab-ci.yml'
|
|
||||||
- local: 'apps/cic-notify/.gitlab-ci.yml'
|
|
||||||
- local: 'apps/cic-meta/.gitlab-ci.yml'
|
|
||||||
- local: 'apps/cic-cache/.gitlab-ci.yml'
|
|
||||||
#- local: 'apps/contract-migration/.gitlab-ci.yml'
|
|
||||||
#- local: 'apps/data-seeding/.gitlab-ci.yml'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/docker-with-compose:latest
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
REGISTRY: registry.gitlab.com/kamikazechaser/cic-monorepo
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
COMPOSE_DOCKER_CLI_BUILD: "1"
|
|
||||||
CI_DEBUG_TRACE: "true"
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||||
|
|
||||||
# runs on protected branches and pushes to repo
|
include:
|
||||||
build-push:
|
- local: 'apps/cic-eth/.gitlab-ci.yml'
|
||||||
stage: build
|
|
||||||
tags:
|
|
||||||
- integration
|
|
||||||
#script:
|
|
||||||
# - TAG=$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA sh ./scripts/build-push.sh
|
|
||||||
script:
|
|
||||||
- TAG=latest sh ./scripts/build-push.sh
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
||||||
when: always
|
|
||||||
|
|
||||||
deploy-dev:
|
|
||||||
stage: deploy
|
|
||||||
trigger: grassrootseconomics/devops
|
|
||||||
when: manual
|
|
@ -1,16 +1,33 @@
|
|||||||
build-test-cic-eth:
|
stages:
|
||||||
stage: test
|
- build-push
|
||||||
tags:
|
- test
|
||||||
- integration
|
|
||||||
variables:
|
variables:
|
||||||
APP_NAME: cic-eth
|
APP_NAME: cic-eth
|
||||||
MR_IMAGE_TAG: mr-$APP_NAME-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
|
|
||||||
|
workflow:
|
||||||
|
rules:
|
||||||
|
- changes:
|
||||||
|
- apps/$APP_NAME/**/*
|
||||||
|
|
||||||
|
cic-eth:build-push:
|
||||||
|
stage: build-push
|
||||||
script:
|
script:
|
||||||
- cd apps/cic-eth
|
- cd apps/$APP_NAME
|
||||||
- docker build -t $MR_IMAGE_TAG -f docker/Dockerfile .
|
- docker pull $REGISTRY/$APP_NAME:latest || true
|
||||||
- docker run $MR_IMAGE_TAG sh docker/run_tests.sh
|
- docker build --cache-from $REGISTRY/$APP_NAME:latest -t $REGISTRY/$APP_NAME:$CI_COMMIT_SHORT_SHA -f docker/Dockerfile .
|
||||||
|
- docker push $REGISTRY/$APP_NAME --all-tags
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "true"
|
||||||
|
|
||||||
|
cic-eth:test:
|
||||||
|
variables:
|
||||||
|
GIT_STRATEGY: none
|
||||||
|
stage: test
|
||||||
|
needs: ["cic-eth:build-push"]
|
||||||
|
variables:
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- docker run $REGISTRY/$APP_NAME:$CI_COMMIT_SHORT_SHA sh docker/run_tests.sh
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
changes:
|
|
||||||
- apps/$APP_NAME/**/*
|
|
||||||
when: always
|
|
||||||
|
Loading…
Reference in New Issue
Block a user