Skip to content

Commit

Permalink
CI: Aktiviere Deployment auf Test-Plattform
Browse files Browse the repository at this point in the history
  • Loading branch information
zgtm committed Sep 22, 2023
1 parent 6f37bc0 commit 8cbb147
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
variables:
GIT_DEPTH: 0

stages:
- deploy
- gitcopy
- testdeploy

testdeploy:
image: 'alpine:latest'
stage: testdeploy
only:
- main
script:
# Setup SSH deploy keys
- 'which ssh-agent || ( apk add --no-cache openssh-client )'
- eval $(ssh-agent -s)
- echo "$DEPLOY_KEY_TEST_JWINF" | ssh-add -
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

# Stop server and upload
- ssh medald@jim.test.bwinf.de "cd medal/tasks/jwinf/jwinf-aufgaben-public ; git pull"
- ssh medald@jim.test.bwinf.de "cd medal/tasks/jwinf/_common/modules ; git pull"
- ssh medald@jim.test.bwinf.de "sudo /bin/systemctl restart medal && exit"
- ssh medald@jim.test.bwinf.de "sudo /bin/systemctl restart medalp && exit"
- sleep 30
- ssh medald@jim.test.bwinf.de "sudo /bin/systemctl status medal && exit"
- ssh medald@jim.test.bwinf.de "sudo /bin/systemctl status medalp && exit"

deploy-job:
gitcopy:
image: bitnami/git
stage: deploy
stage: gitcopy
only:
- main
variables:
GIT_DEPTH: 0
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
Expand Down

0 comments on commit 8cbb147

Please sign in to comment.