Skip to content
Snippets Groups Projects
Commit 5b631eed authored by thijsheijden's avatar thijsheijden
Browse files

Added Deploy stage

Deploy stage has essentially been copied over from the old frontend, so changes WILL have to be made to get it to work properly.
parent 0132c263
No related branches found
No related tags found
No related merge requests found
Pipeline #114819 canceled
......@@ -47,7 +47,7 @@ test:
script:
- yarn nx affected --base=HEAD~1 --target=test --parallel --max-parallel=2
build-docker:
docker:
image: docker:stable
stage: docker
tags:
......@@ -64,3 +64,26 @@ build-docker:
- docker push datastropheregistry.azurecr.io/$CI_PROJECT_NAME:$DOCKER_TAG
dependencies:
- build
deploy:
stage: deploy
only:
- main
- develop
script:
- apk add --update --no-cache openssh-client >/dev/null
- mkdir ~/.ssh/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-add ~/.ssh/id_rsa
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ssh -fN -L 1234:science-vs260.science.uu.nl:22 sivan@up.science.uu.nl
# Copy kubernetes files over
- scp -r -o StrictHostKeyChecking=no -P 1234 -i ~/.ssh/id_rsa deployments/* root@localhost:/root/kubernetes/$CI_PROJECT_NAME
# Deploy all yml files
- ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "for i in kubernetes/$CI_PROJECT_NAME/*.yml; do kubectl apply -f \$i; done"
# Perform rolling update for deployment
- ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl rollout restart -f kubernetes/$CI_PROJECT_NAME/deployment.yml"
dependencies: []
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