Skip to content

Commit

Permalink
CI/CD move docker loging to every job
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed Nov 20, 2023
1 parent 044b6a7 commit 16289dd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ image: docker/compose:latest
services:
- docker:dind

before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- apk add --no-cache git
- export SRC_HASH=$(git rev-parse HEAD)

stages:
- build
- test
Expand All @@ -22,6 +17,9 @@ stages:

build:
stage: build
before_script:
- export SRC_HASH=$(git rev-parse HEAD)
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- echo $(date +%Y%m%d-%H%M%S) > $CI_PROJECT_DIR/datetag.txt
- export DATETAG=$(cat $CI_PROJECT_DIR/datetag.txt)
Expand All @@ -36,6 +34,8 @@ build:
- datetag.txt
test:
stage: test
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- cp docker/dockerfile-webapp-test docker/dockerfile-webapp-test-local
- sed -i "s+tmt-data+registry.softcatala.org/github/translation-memory-tools/tmt-data:$CI_COMMIT_REF_NAME+g" docker/dockerfile-webapp-test-local
Expand All @@ -44,6 +44,9 @@ test:

publish:
stage: publish
before_script:
- export SRC_HASH=$(git rev-parse HEAD)
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- export DATETAG=$(cat $CI_PROJECT_DIR/datetag.txt)
- docker push $CI_REGISTRY_IMAGE:$DATETAG
Expand Down

0 comments on commit 16289dd

Please sign in to comment.