Commit a35ed92f authored by Christophe Benz's avatar Christophe Benz

Define generate job as interruptible, factor deploy jobs

parent ca52d7a9
Pipeline #115402 passed with stages
in 3 minutes and 23 seconds
......@@ -13,6 +13,7 @@ Generate dashboard:
paths:
- .cache/pip
- venv/
interruptible: true
before_script:
- python -m venv venv
- source venv/bin/activate
......@@ -23,17 +24,10 @@ Generate dashboard:
paths:
- dashboard.html
Deploy review dashboard:
.deploy_job:
stage: deploy
only:
- branches
except:
- master
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://dashboard.db.nomics.world/$CI_COMMIT_REF_NAME.html
on_stop: Stop review dashboard
variables:
DASHBOARD_HOST: dashboard.db.nomics.world
GIT_STRATEGY: none
image: debian:stable
before_script:
......@@ -44,53 +38,36 @@ Deploy review dashboard:
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# Add the SSH keys of remote Git servers, to disable host key checking questions.
- mkdir -p ~/.ssh
- ssh-keyscan -t rsa dashboard.db.nomics.world >> ~/.ssh/known_hosts
script:
- scp dashboard.html dashboard@dashboard.db.nomics.world:dbnomics-dashboard-static/$CI_COMMIT_REF_NAME.html
- ssh-keyscan -t rsa $DASHBOARD_HOST >> ~/.ssh/known_hosts
Stop review dashboard:
stage: deploy
when: manual
Deploy review dashboard:
extends: .deploy_job
only:
- branches
except:
- master
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$DASHBOARD_HOST/$CI_COMMIT_REF_NAME.html
on_stop: Stop review dashboard
script:
- scp dashboard.html dashboard@$DASHBOARD_HOST:dbnomics-dashboard-static/$CI_COMMIT_REF_NAME.html
Stop review dashboard:
extends: .deploy_job
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
variables:
GIT_STRATEGY: none
image: debian:stable
before_script:
- apt-get update && apt-get install -y ssh
# Run ssh-agent (inside the build environment).
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store.
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# Add the SSH keys of remote Git servers, to disable host key checking questions.
- mkdir -p ~/.ssh
- ssh-keyscan -t rsa dashboard.db.nomics.world >> ~/.ssh/known_hosts
script:
- ssh dashboard@dashboard.db.nomics.world "rm dbnomics-dashboard-static/$CI_COMMIT_REF_NAME.html"
- ssh dashboard@$DASHBOARD_HOST "rm dbnomics-dashboard-static/$CI_COMMIT_REF_NAME.html"
Deploy production dashboard:
stage: deploy
extends: .deploy_job
only:
- master
environment:
name: production
url: https://dashboard.db.nomics.world/
variables:
GIT_STRATEGY: none
image: debian:stable
before_script:
- apt-get update && apt-get install -y ssh
# Run ssh-agent (inside the build environment).
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store.
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# Add the SSH keys of remote Git servers, to disable host key checking questions.
- mkdir -p ~/.ssh
- ssh-keyscan -t rsa dashboard.db.nomics.world >> ~/.ssh/known_hosts
url: https://$DASHBOARD_HOST/
script:
- scp dashboard.html dashboard@dashboard.db.nomics.world:dbnomics-dashboard-static/index.html
- scp dashboard.html dashboard@$DASHBOARD_HOST:dbnomics-dashboard-static/index.html
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