diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f74fe8805e4a7321b7fd6abcf07da628498d253f..730e70065640f7aae5eb489bfdbfcbce93f26c8b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ test-code: - if: '$GITLAB_HOST == "git.astron.nl"' # deploy to 'sdc-dev.astron.nl' -docker-deploy-to-test: +docker-deploy-to-test-gitlab-astron: image: docker:latest stage: deploy_to_test tags: @@ -63,7 +63,7 @@ docker-deploy-to-test: # deploy to 'sdc.astron.nl' -docker-deploy-to-production: +docker-deploy-to-production-gitlab-astron: image: docker:latest stage: deploy_to_production tags: @@ -83,4 +83,52 @@ docker-deploy-to-production: - ssh -o StrictHostKeyChecking=no sdco@dop821.astron.nl "docker-compose -p atdb -f /opt/dockercompose/atdb-ldv-compose/docker-compose-production-cd.yml up -d" when: manual rules: - - if: '$GITLAB_HOST == "git.astron.nl"' \ No newline at end of file + - if: '$GITLAB_HOST == "git.astron.nl"' + + +# deploy to 'sdc-dev.astron.nl' +docker-deploy-to-test-gitlab-com: + image: docker:latest + stage: deploy_to_test + tags: + - "sdc-dev" + before_script: + - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY_USER_SDC" | tr -d '\r' | ssh-add - + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - ssh-keyscan dop814.astron.nl >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + script: + - scp -O -o StrictHostKeyChecking=no atdb/docker/docker-compose-dev-cd.yml sdc@dop814.astron.nl:/docker_compose/atdb-ldv/docker-compose-dev-cd.yml + - ssh -o StrictHostKeyChecking=no sdc@dop814.astron.nl "echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY" + - ssh -o StrictHostKeyChecking=no sdc@dop814.astron.nl "docker pull "$CI_REGISTRY_IMAGE"" + - ssh -o StrictHostKeyChecking=no sdc@dop814.astron.nl "docker-compose -p atdb -f /docker_compose/atdb-ldv/docker-compose-dev-cd.yml up -d" + when: manual + rules: + - if: '$GITLAB_HOST != "git.astron.nl"' + + +# deploy to 'sdc.astron.nl' +docker-deploy-to-production-gitlab-com: + image: docker:latest + stage: deploy_to_production + tags: + - "sdc-dev" + before_script: + - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY_USER_SDC" | tr -d '\r' | ssh-add - + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - ssh-keyscan dop821.astron.nl >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + script: + - scp -O -o StrictHostKeyChecking=no atdb/docker/docker-compose-production-cd.yml sdco@dop821.astron.nl:/opt/dockercompose/atdb-ldv-compose/docker-compose-production-cd.yml + - ssh -o StrictHostKeyChecking=no sdco@dop821.astron.nl "echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY" + - ssh -o StrictHostKeyChecking=no sdco@dop821.astron.nl "docker pull "$CI_REGISTRY_IMAGE"" + - ssh -o StrictHostKeyChecking=no sdco@dop821.astron.nl "docker-compose -p atdb -f /opt/dockercompose/atdb-ldv-compose/docker-compose-production-cd.yml up -d" + when: manual + rules: + - if: '$GITLAB_HOST != "git.astron.nl"'