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

Merge branch 'SDC-743-add-workflow-parameters' into 'master'

updating ci/cd pipeline with stages and do it as user 'sdc' instead of 'vermaas'

See merge request !261
parents 6cb9356b 28a40154
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 #37909 passed
/atdb/logs/
stages: stages:
- build - build
- deploy - deploy_to_test
- deploy_to_production
docker-build-master: docker-build:
# Official docker image. # Official docker image.
image: docker:latest image: docker:latest
stage: build stage: build
...@@ -13,69 +14,34 @@ docker-build-master: ...@@ -13,69 +14,34 @@ docker-build-master:
script: script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" atdb - docker build --pull -t "$CI_REGISTRY_IMAGE" atdb
- docker push "$CI_REGISTRY_IMAGE" - docker push "$CI_REGISTRY_IMAGE"
only: # only:
- master
- acceptance
- release
#docker-build-branch:
# Official docker image.
# image: docker:latest
# stage: build
# services:
# - docker:dind
# before_script:
# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# script:
# - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" atdb
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
# except:
# - master # - master
# - acceptance
# - release
# deploy test/dev version on 'sdc-dev.astron.nl'
docker-deploy-master:
image: docker:latest
stage: deploy
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 acceptance version on 'dop457.astron.nl' # deploy master or branch to 'sdc-dev.astron.nl'
docker-deploy-acceptance: docker-deploy-to-test:
image: docker:latest image: docker:latest
stage: deploy stage: deploy_to_test
before_script: before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- ssh-keyscan dop457.astron.nl >> ~/.ssh/known_hosts - ssh-keyscan dop814.astron.nl >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts
script: script:
- ssh -o StrictHostKeyChecking=no vermaas@dop457.astron.nl "docker pull "$CI_REGISTRY_IMAGE"" - 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 vermaas@dop457.astron.nl "docker-compose -p atdb -f /data/docker_compose/docker-compose-atdb-ldv-acc-cd.yml up -d" - 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 when: manual
only: # only:
- acceptance # - master
# deploy release version on 'sdc.astron.nl' # deploy master branch to 'sdc.astron.nl'
docker-deploy-release: docker-deploy-master-to-production:
image: docker:latest image: docker:latest
stage: deploy stage: deploy_to_production
before_script: before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
...@@ -90,4 +56,4 @@ docker-deploy-release: ...@@ -90,4 +56,4 @@ docker-deploy-release:
- 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" - 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 when: manual
only: only:
- release - master
\ No newline at end of file \ 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 - 14:00)
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment