Refacto CI
Add 2 pipelines : one for test and one for prod Add 2 stages : build and deploy Use gitlab features to deduplicate code (general before-script, variables, yaml expansion)
This commit is contained in:
parent
1971309714
commit
57e18ef24a
|
@ -2,15 +2,36 @@ image: docker
|
|||
services:
|
||||
- docker:dind
|
||||
|
||||
before_script:
|
||||
- apk add --no-cache curl
|
||||
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab.rezometz.org:5678
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
build_job:
|
||||
.build_image: &build_image
|
||||
stage: build
|
||||
script:
|
||||
- apk add --no-cache curl
|
||||
- docker build -f Dockerfile -t gitlab.rezometz.org:5678/klafyvel/klafirc .
|
||||
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab.rezometz.org:5678
|
||||
- docker push gitlab.rezometz.org:5678/klafyvel/klafirc:latest
|
||||
- "curl -X POST lupercus.rez -d \"$API_VARS\" -H \"Content-Type: application/json\""
|
||||
- docker build -f Dockerfile -t gitlab.rezometz.org:5678/klafyvel/klafirc:$CI_COMMIT_SHA .
|
||||
|
||||
build_image_test:
|
||||
<<: *build_image
|
||||
stage: build
|
||||
except: master
|
||||
after_script:
|
||||
- echo "test: CI_REGISTRY_IMAGE"
|
||||
|
||||
build_image_prod:
|
||||
<<: *build_image
|
||||
stage: build
|
||||
after_script:
|
||||
- docker tag gitlab.rezometz.org:5678/klafyvel/klafirc:$CI_COMMIT_SHA gitlab.rezometz.org:5678/klafyvel/klafirc:latest
|
||||
- docker push gitlab.rezometz.org:5678/klafyvel/klafirc:latest
|
||||
only: master
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
- "curl -X POST lupercus.rez -d \"$API_VARS\" -H \"Content-Type: application/json\""
|
||||
dependencies: build_image_prod
|
Loading…
Reference in a new issue