forked from MODFLOW-USGS/modflow6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
31 lines (30 loc) · 1.45 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
image: ubuntu:20.04
workflow:
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == 'push'
before_script:
# install ssh agent
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
# configure ssh agent
- eval $(ssh-agent -s)
# set private key permissions
- chmod 400 "$SSH_PRIVATE_KEY"
# add key to the agent store
- ssh-add "$SSH_PRIVATE_KEY"
# configure known hosts
- mkdir -p ~/.ssh
- cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
deploy_denali:
stage: deploy
script: |
# fetch and checkout latest
ssh -l "$SSH_USERNAME" "$SSH_HOSTNAME" "cd $MF6_PROJ_ROOT && git fetch $GIT_REMOTE && git checkout $GIT_BRANCH && git pull"
echo "Updated repository $MF6_PROJ_ROOT"
# submit a job to build mf6
jobid=$(ssh -l "$SSH_USERNAME" "$SSH_HOSTNAME" "sbatch --account=$SLURM_ACCOUNT --reservation=$SLURM_RESERVATION --parsable -D $MF6_PROJ_ROOT/.hpc $MF6_PROJ_ROOT/$BUILD_SCRIPT" | tail -n 1)
echo "Submitted build job $jobid"
# submit a job to update the mf6 module
jobid=$(ssh -l "$SSH_USERNAME" "$SSH_HOSTNAME" "sbatch --export=ALL,INTEL_VERSION=$INTEL_VERSION,MF6_PROJ_ROOT=$MF6_PROJ_ROOT,MODULES_PATH=$MODULES_PATH --account=$SLURM_ACCOUNT --reservation=$SLURM_RESERVATION --parsable -D $MF6_PROJ_ROOT/.hpc -d afterok:$jobid $MF6_PROJ_ROOT/$MODULE_SCRIPT" | tail -n 1)
echo "Submitted module update job $jobid"
environment: denali