Commit 4dd13fff authored by Andrew Okin's avatar Andrew Okin

Add job to stop branch environments

parent 9db7eaac
Pipeline #28 passed with stages
in 53 seconds
......@@ -57,10 +57,27 @@ deploy_branch:
environment:
name: branch/$CI_COMMIT_REF_NAME
url: https://test.forkk.net/branch/$CI_COMMIT_REF_SLUG
on_stop: stop_branch
script:
- echo "$SSH_TEST_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- rsync -a --delete _site/ "$SSH_BRANCH_DEPLOY_DEST/$CI_COMMIT_REF_SLUG"
stop_branch:
extends: .deploy
dependencies: []
when: manual
variables:
GIT_STRATEGY: none
environment:
name: branch/$CI_COMMIT_REF_NAME
action: stop
script:
# Ensure ssh is installed
- 'which ssh || ( apt-get update -y && apt-get install ssh -y )'
- REMOTE="$(echo $SSH_BRANCH_DEPLOY_DEST | cut -d':' -f1)"
- PATH="$(echo $SSH_BRANCH_DEPLOY_DEST | cut -d':' -f2)"
- ssh "$REMOTE" "rm -r $PATH"
.deploy:
stage: deploy
dependencies:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment