Skip to content
Snippets Groups Projects
Commit 634e7662 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

updating ci/cd pipeline with stages

testing if deploy still works (after 3 months)
parent c3f00d7f
No related branches found
No related tags found
1 merge request!261updating ci/cd pipeline with stages and do it as user 'sdc' instead of 'vermaas'
Pipeline #37877 failed
/atdb/logs/
stages: stages:
- build - build
- deploy - deploy
- deploy_to_test
- deploy_to_production
docker-build-master: docker-build-master:
# Official docker image. # Official docker image.
...@@ -18,21 +20,21 @@ docker-build-master: ...@@ -18,21 +20,21 @@ docker-build-master:
- acceptance - acceptance
- release - release
#docker-build-branch: docker-build-branch:
# Official docker image. # Official docker image.
# image: docker:latest image: docker:latest
# stage: build stage: build
# services: services:
# - docker:dind - docker:dind
# before_script: before_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
# script: script:
# - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" atdb - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" atdb
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
# except: except:
# - master - master
# - acceptance - acceptance
# - release - release
# deploy test/dev version on 'sdc-dev.astron.nl' # deploy test/dev version on 'sdc-dev.astron.nl'
docker-deploy-master: docker-deploy-master:
...@@ -53,6 +55,7 @@ docker-deploy-master: ...@@ -53,6 +55,7 @@ docker-deploy-master:
only: only:
- master - master
# deploy acceptance version on 'dop457.astron.nl' # deploy acceptance version on 'dop457.astron.nl'
docker-deploy-acceptance: docker-deploy-acceptance:
image: docker:latest image: docker:latest
...@@ -91,3 +94,43 @@ docker-deploy-release: ...@@ -91,3 +94,43 @@ docker-deploy-release:
when: manual when: manual
only: only:
- release - release
# deploy master branch to 'sdc-dev.astron.nl'
docker-deploy-to-test:
image: docker:latest
stage: deploy-to-test
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" | 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:
- ssh -o StrictHostKeyChecking=no vermaas@dop814.astron.nl "docker pull "$CI_REGISTRY_IMAGE""
- ssh -o StrictHostKeyChecking=no vermaas@dop814.astron.nl "docker-compose -p atdb -f /docker_compose/atdb-ldv/docker-compose-dev-cd.yml up -d"
when: manual
# only:
# - master
# deploy master branch to 'sdc.astron.nl'
docker-deploy-to-production:
image: docker:latest
stage: deploy-to-production
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" | 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:
- 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
only:
- release
\ No newline at end of file
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
</div> </div>
<p class="footer"> Version 1.0.0 (11 jul 2022 - 9:00) <p class="footer"> Version 1.0.0 (20 oct 2022 - 10:00)
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment