Commit 972341ff authored by Gibbs, Ian's avatar Gibbs, Ian
Browse files

Update .gitlab-ci.yml file

parent 466857fb
Loading
Loading
Loading
Loading
Loading
+6 −36
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ stages:
# Jobs Section
#####

env-dev:
.env-dev:
  stage: 0up_validate
  extends: .validate-env
  stage: test
  variables:
    CONDA_ENV_FILE: "scd-reduction-tools-dev.yml"
  rules:  # when either matches
@@ -49,9 +49,9 @@ env-dev:
  tags:
    - neutrons-multi-builder

env-qa:
.env-qa:
  stage: 0up_validate
  extends: .validate-env
  stage: test
  variables:
    CONDA_ENV_FILE: "scd-reduction-tools-qa.yml"
  rules:  # when either matches
@@ -60,9 +60,9 @@ env-qa:
  tags:
    - neutrons-multi-builder

env-prod:
.env-prod:
  stage: 0up_validate
  extends: .validate-env
  stage: test
  variables:
    CONDA_ENV_FILE: "scd-reduction-tools.yml"
  rules:  # when either matches
@@ -71,33 +71,3 @@ env-prod:
  tags:
    - neutrons-multi-builder
# this can be called with the name of any playbook in
# https://code.ornl.gov/sns-hfir-scse/deployments/conda-legacy-deploy/-/tree/main/playbooks/conda
# expected to be create, recreate, remove, or update
deploy:
  stage: deploy
  script:
    - func_rse_docker_cleanup
    - docker login --username=${CI_REGISTRY_USER} --password=${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
    # decide the environment to run - default is drtsans-dev
    - if [ -z ${CONDA_ENV} ]; then CONDA_ENV="scd-reduction-tools-dev"; fi
    - test -f "${CONDA_ENV}.yml" || (echo "Did not find ${CONDA_ENV}.yml" && exit 1)
    # verify the requested playbook is available
    - docker run ${ANSIBLE_DEPLOY_IMG} /bin/bash -c "test -f $PLAY.yml"
    # setup things for ssh
    - if [ -z ${SSH_USER} ]; then echo "no user" ; exit 1; fi
    - mv ${SSH_KEY_FILE} $PWD/ssh-key
    - chmod 600 $PWD/ssh-key
    # test the key works
    # run the playbook and remove ssh-key
    - echo ${PWD}
    - echo ${CONDA_ENV}
    - echo ${ANSIBLE_DEPLOY_IMG}
    - echo ${SSH_USER}
    - echo ${PLAY}
    - docker run -u 0 -v ${PWD}/ssh-key:/home/ansible/key.private -v ${PWD}/${CONDA_ENV}.yml:/home/ansible/${CONDA_ENV}.yml ${ANSIBLE_DEPLOY_IMG} /bin/bash -c "ansible-playbook -u ${SSH_USER} --private-key=/home/ansible/key.private -v -e CONDA_ENV=${CONDA_ENV} ${TARGET} ${PLAY}.yml"
    - rm $PWD/ssh-key
  tags:
    - scse-runner1
  rules:
    - if: $PLAY && $CI_COMMIT_REF_PROTECTED