Skip to content
Snippets Groups Projects
Commit 397ff409 authored by Jean-Karim Heriche's avatar Jean-Karim Heriche
Browse files

Remove deploy stage

parent f197021e
No related branches found
No related tags found
No related merge requests found
......@@ -14,17 +14,9 @@ workflow:
- if: $CI_COMMIT_BRANCH == 'master'
# To run deploy after build
stages:
- build
- deploy
before_script:
- echo "Registry info:"
- echo $CI_REGISTRY
- echo $CI_REGISTRY_IMAGE
- echo $CI_REGISTRY_NAME
- echo $CI_REGISTRY_USER
build:
stage: build
......@@ -39,28 +31,3 @@ build:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --registry-mirror regmirror.embl.de --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
deploy:
image: ubuntu:focal
stage: deploy
only:
- tags
script:
# Check if ssh-agent is present, install if not
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
# Run ssh-agent in the deploy environment
- eval $(ssh-agent -s)
# Add the SSH key from the SSH_PRIVATE_KEY variable to the agent store
# Use tr to fix line endings
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan cbbcs-01.embl.de >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# Pull new container on server cbbcs-01
# User cbbcs needs to be member of the docker group
# to run the docker command
# Docker needs to log into the project's registry first
- ssh -o StrictHostKeyChecking=no cbbcs@cbbcs-01.embl.de "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY"
- ssh -o StrictHostKeyChecking=no cbbcs@cbbcs-01.embl.de "docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
# Tag the new image as latest
- ssh -o StrictHostKeyChecking=no cbbcs@cbbcs-01.embl.de "docker image tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG $CI_REGISTRY_IMAGE:latest"
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