The URI of TUHH Docker Registry changed from "docker.rz.tu-harburg.de:5000" to "docker.rz.tu-harburg.de". Please update your gitlab-ci.yml files if you use images from this registry.

Commit 5a53d237 authored by Michael Chen's avatar Michael Chen

Merge branch 'deploy-test' into 'master'

Deployment modes as seperate jobs

See merge request !9
parents fa6b09ff 17c52971
Pipeline #79759 canceled with stage
variables: variables:
IMAGE_NAME: travel-time IMAGE_NAME: travel-time
DEPLOY_REGISTRY: collaborating.tuhh.de:5005 DEPLOY_REGISTRY: collaborating.tuhh.de:5005
FULL_IMAGE_NAME: $DEPLOY_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME
# Expect DOCKER_USERNAME variable from repository settings # Expect DOCKER_USERNAME variable from repository settings
# Expect DOCKER_ACCESS_TOKEN variable from repository settings (can also be password when login is without 2FA) # Expect DOCKER_ACCESS_TOKEN variable from repository settings (can also be password when login is without 2FA)
stages: default:
- build
- deploy
ci_debug:
stage: .pre
script:
- 'dir env:'
tags: tags:
- windows - windows
- powershell - powershell
stages:
- build
- deploy
build_image: build_image:
stage: build stage: build
script: script:
- docker build -t ${env:IMAGE_NAME} . - docker build -t ${env:IMAGE_NAME} .
tags:
- windows
- powershell
deploy_image_latest: deploy_master_image:
stage: deploy stage: deploy
variables:
TAGGED_IMAGE: $DEPLOY_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME
before_script: before_script:
- echo "Deploying ${env:FULL_IMAGE_NAME} as latest..." - echo "Deploying ${env:TAGGED_IMAGE} (latest)..."
- echo "Login for user ${env:DOCKER_USERNAME} using access token!" - echo "Login for user ${env:DOCKER_USERNAME} using access token!"
- echo ${env:DOCKER_ACCESS_TOKEN} | docker login -u ${env:DOCKER_USERNAME} --password-stdin ${env:DEPLOY_REGISTRY} - echo ${env:DOCKER_ACCESS_TOKEN} | docker login -u ${env:DOCKER_USERNAME} --password-stdin ${env:DEPLOY_REGISTRY}
script: script:
- docker tag ${env:IMAGE_NAME} ${env:FULL_IMAGE_NAME} - docker tag ${env:IMAGE_NAME} ${env:TAGGED_IMAGE}
- docker push ${env:FULL_IMAGE_NAME} - docker push ${env:TAGGED_IMAGE}
tags:
- windows
- powershell
only: only:
variables: variables:
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- $CI_COMMIT_TAG
deploy_branch_image:
stage: deploy
variables:
TAGGED_IMAGE: $DEPLOY_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME:$CI_COMMIT_BRANCH
before_script:
- echo "Deploying ${env:TAGGED_IMAGE}..."
- echo "Login for user ${env:DOCKER_USERNAME} using access token!"
- echo ${env:DOCKER_ACCESS_TOKEN} | docker login -u ${env:DOCKER_USERNAME} --password-stdin ${env:DEPLOY_REGISTRY}
script:
- docker tag ${env:IMAGE_NAME} ${env:TAGGED_IMAGE}
- docker push ${env:TAGGED_IMAGE}
only:
variables:
- $CI_COMMIT_TITLE =~ /^\[deploy\]/i - $CI_COMMIT_TITLE =~ /^\[deploy\]/i
# Deploy tagged image only if pipeline is run on tag # Deploy tagged image only if pipeline is run on tag
deploy_image_tagged: deploy_image_tagged:
stage: deploy stage: deploy
variables: variables:
TAGGED_IMAGE: $FULL_IMAGE_NAME:$CI_COMMIT_TAG TAGGED_IMAGE: $DEPLOY_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME:$CI_COMMIT_TAG
before_script: before_script:
- echo "Deploying ${env:TAGGED_IMAGE}..." - echo "Deploying ${env:TAGGED_IMAGE}..."
- echo "Login for user ${env:DOCKER_USERNAME} using access token!" - echo "Login for user ${env:DOCKER_USERNAME} using access token!"
...@@ -55,9 +60,6 @@ deploy_image_tagged: ...@@ -55,9 +60,6 @@ deploy_image_tagged:
script: script:
- docker tag ${env:IMAGE_NAME} ${env:TAGGED_IMAGE} - docker tag ${env:IMAGE_NAME} ${env:TAGGED_IMAGE}
- docker push ${env:TAGGED_IMAGE} - docker push ${env:TAGGED_IMAGE}
tags:
- windows
- powershell
only: only:
variables: variables:
- $CI_COMMIT_TAG - $CI_COMMIT_TAG
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment