Skip to content
Snippets Groups Projects
Commit 8b85dae9 authored by schnarkus's avatar schnarkus
Browse files

tag in a sepate job

parent 743b3d28
No related branches found
No related tags found
No related merge requests found
Pipeline #68711 failed
...@@ -13,6 +13,7 @@ variables: ...@@ -13,6 +13,7 @@ variables:
stages: stages:
- test - test
- build - build
- tag
- publish - publish
test_job: test_job:
...@@ -33,12 +34,28 @@ build_job: ...@@ -33,12 +34,28 @@ build_job:
tags: tags:
- docker-privileged - docker-privileged
script: script:
- docker build -t $CI_REGISTRY_IMAGE:$version -t $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:$environment_tag -f Containerfile . - docker build -t $CI_REGISTRY_IMAGE:$version -f Containerfile .
artifacts: artifacts:
paths: paths:
- artifact.bin - artifact.bin
expire_in: 5 min expire_in: 5 min
tag_job:
stage: tag
rules:
- if: $CI_COMMIT_REF_NAME == "prod" || $CI_COMMIT_REF_NAME == "dev"
when: always
image: docker:latest
services:
- docker:dind
tags:
- docker-privileged
dependencies:
- build_job
script:
- docker tag $CI_REGISTRY_IMAGE:$version $CI_REGISTRY_IMAGE:latest
- docker tag $CI_REGISTRY_IMAGE:$version $CI_REGISTRY_IMAGE:$environment_tag
publish_job: publish_job:
stage: publish stage: publish
rules: rules:
...@@ -49,6 +66,8 @@ publish_job: ...@@ -49,6 +66,8 @@ publish_job:
- docker:dind - docker:dind
tags: tags:
- docker-privileged - docker-privileged
dependencies:
- tag_job
script: script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE:$version - docker push $CI_REGISTRY_IMAGE:$version
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment