Build latest sooner and only retag to publish
This commit is contained in:
parent
06205dbaea
commit
87ff32cbc9
1 changed files with 27 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
- build and publish
|
- publish
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
@ -10,8 +10,9 @@ variables:
|
||||||
IMAGE_REGISTRY: rg.fr-par.scw.cloud/crocmagnon
|
IMAGE_REGISTRY: rg.fr-par.scw.cloud/crocmagnon
|
||||||
IMAGE_TESTS: $CI_REGISTRY_IMAGE:tests-latest
|
IMAGE_TESTS: $CI_REGISTRY_IMAGE:tests-latest
|
||||||
IMAGE_DEPS_TESTS: $CI_REGISTRY_IMAGE:tests-deps
|
IMAGE_DEPS_TESTS: $CI_REGISTRY_IMAGE:tests-deps
|
||||||
IMAGE_LATEST: rg.fr-par.scw.cloud/crocmagnon/blog:latest
|
IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
|
||||||
IMAGE_DEPS_LATEST: $CI_REGISTRY_IMAGE:deps
|
IMAGE_DEPS_LATEST: $CI_REGISTRY_IMAGE:deps
|
||||||
|
IMAGE_LATEST_PUBLIC: rg.fr-par.scw.cloud/crocmagnon/blog:latest
|
||||||
|
|
||||||
PRE_COMMIT_IMAGE: rg.fr-par.scw.cloud/crocmagnon/pre-commit:latest
|
PRE_COMMIT_IMAGE: rg.fr-par.scw.cloud/crocmagnon/pre-commit:latest
|
||||||
|
|
||||||
|
@ -41,9 +42,22 @@ build for tests:
|
||||||
- export IMAGE=$IMAGE_TESTS
|
- export IMAGE=$IMAGE_TESTS
|
||||||
- export DEPS=$IMAGE_DEPS_TESTS
|
- export DEPS=$IMAGE_DEPS_TESTS
|
||||||
|
|
||||||
|
build latest:
|
||||||
|
<<: *build
|
||||||
|
stage: build
|
||||||
|
variables:
|
||||||
|
POETRY_OPTIONS: "--no-dev"
|
||||||
|
before_script:
|
||||||
|
- export IMAGE=$IMAGE_LATEST
|
||||||
|
- export DEPS=$IMAGE_DEPS_LATEST
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
.tests: &tests
|
.tests: &tests
|
||||||
stage: test
|
stage: test
|
||||||
image: $IMAGE_TESTS
|
image: $IMAGE_TESTS
|
||||||
|
needs:
|
||||||
|
- build for tests
|
||||||
|
|
||||||
unit tests:
|
unit tests:
|
||||||
<<: *tests
|
<<: *tests
|
||||||
|
@ -64,14 +78,18 @@ missing migrations:
|
||||||
- cd /app
|
- cd /app
|
||||||
- python manage.py makemigrations --check
|
- python manage.py makemigrations --check
|
||||||
|
|
||||||
build and publish latest:
|
publish latest:
|
||||||
<<: *build
|
stage: publish
|
||||||
stage: build and publish
|
image: docker:20.10.1
|
||||||
variables:
|
services:
|
||||||
POETRY_OPTIONS: "--no-dev"
|
- docker:20.10.1-dind
|
||||||
before_script:
|
before_script:
|
||||||
- export IMAGE=$IMAGE_LATEST
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
- export DEPS=$IMAGE_DEPS_LATEST
|
- docker login -u $REGISTRY_USER -p $REGISTRY_PASSWORD $IMAGE_REGISTRY
|
||||||
|
script:
|
||||||
|
- docker pull $IMAGE_LATEST
|
||||||
|
- docker tag $IMAGE_LATEST $IMAGE_LATEST_PUBLIC
|
||||||
|
- docker push $IMAGE_LATEST_PUBLIC
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
|
Reference in a new issue