diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76965e220dd0348f1bbb095c87fe2219779696ff..f900ee7a52bb571c9234a35d018e148c42e28d42 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ variables: DEPLOY_URL: "/var/www/html/cassiopee" DEPLOY_STABLE_URL: "/var/www/cassiopee-production" RELEASES_URL: "$DEPLOY_STABLE_URL/cassiopee-releases" + JALHYD_BRANCH: "$(scripts/get_jalhyd_branch_name.sh $CI_COMMIT_REF_NAME)" before_script: # load private key from GitLab CI variable, to deploy on Aubes server @@ -26,6 +27,7 @@ before_script: - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config cache: + key: $JALHYD_BRANCH paths: - node_modules/ @@ -37,10 +39,7 @@ jalhyd: - schedules - web script: - - JALHYD_BRANCH=`cat jalhyd_branch` - echo "CI_COMMIT_REF_NAME - $CI_COMMIT_REF_NAME" - - if [ "$CI_COMMIT_REF_NAME" = "master" ]; then JALHYD_BRANCH="master"; fi - - if [ "$CI_COMMIT_REF_NAME" = "devel" ]; then JALHYD_BRANCH="devel"; fi - echo "Branche JalHyd - $JALHYD_BRANCH" - cd .. - rm -rf jalhyd diff --git a/scripts/get_jalhyd_branch_name.sh b/scripts/get_jalhyd_branch_name.sh new file mode 100755 index 0000000000000000000000000000000000000000..93dba3d59f0f311bdd6c3ff09fdd6aab7c10eb66 --- /dev/null +++ b/scripts/get_jalhyd_branch_name.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# get jalhyd branch linked to current nghyd branch. +# input parameter : nghyd branch name +# return jalhyd branch name + +if (( $# != 1 )); then + echo "syntax : $(basename $0) <nghyd branch name>" >&2 + exit 1 +fi + +nghyd_branch=$1 + +jalhyd_branch=`cat jalhyd_branch` +if [[ "$nghyd_branch" = "master" ]]; then jalhyd_branch="master"; fi +if [[ "$nghyd_branch" = "devel" ]]; then jalhyd_branch="devel"; fi +echo $jalhyd_branch