Commit ed55b5eb authored by Hetrick, John's avatar Hetrick, John
Browse files

Merge branch 'pipeline-changes' into 'main'

Pipeline changes for Submodule Update

See merge request !2
parents e99be335 8fa3b614
Loading
Loading
Loading
Loading
Loading
+32 −130
Original line number Diff line number Diff line
---

workflow:
  rules: [ when: always ]

variables:
  #GIT_STRATEGY: fetch
  ANSIBLE_DEPLOY_IMG: code.ornl.gov:4567/sns-hfir-scse/deployments/conda-legacy-deploy/ansible-neutrons:latest

include:
  - project: "sns-hfir-scse/deployments/conda-legacy-deploy"
    file: "gitlab-tasks/validate_conda_env.yml"

before_script:
    - curl https://code.ornl.gov/rse-deployment/rse-sharables/raw/master/rse-bash-modules.sh -O
    - source rse-bash-modules.sh
    - func_rse_docker_cleanup
    - docker login --username=$CI_REGISTRY_USER --password=$CI_REGISTRY_PASSWORD $CI_REGISTRY

.zoro:
  variables:
    Z_CI_PIPELINE_SOURCE:  "$CI_PIPELINE_SOURCE"
    Z_CI_PROJECT_PATH:     "$CI_PROJECT_PATH"
    Z_CI_JOB_NAME:         "$CI_JOB_NAME"
    Z_CI_COMMIT_REF_NAME:  "$CI_COMMIT_REF_NAME"
    Z_SUBMODULE_NAME:      "$CI_PROJECT_NAME"
  trigger: { project: sns-hfir-scse/deployments/conda-deploy, branch: main, strategy: depend }


stages:
  - 0up_validate
  - 1up_submodule
  - 2up_deploy
  - 3up_validate
  - 4up_syndicate


#####
# Jobs Section
#####

.env-dev:
  stage: 0up_validate
  extends: .validate-env
  variables:
    CONDA_ENV_FILE: "scd-reduction-tools-dev.yml"
  rules:  # when either matches
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CONDA_ENV == "scd-reduction-tools-dev"
  tags:
    - neutrons-multi-builder

.env-qa:
  stage: 0up_validate
  extends: .validate-env
  variables:
    CONDA_ENV_FILE: "scd-reduction-tools-qa.yml"
  rules:  # when either matches
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CONDA_ENV == "scd-reduction-tools-qa"
  tags:
    - neutrons-multi-builder

.env-prod:
  stage: 0up_validate
  extends: .validate-env
  variables:
    CONDA_ENV_FILE: "scd-reduction-tools.yml"
  rules:  # when either matches
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CONDA_ENV == "scd-reduction-tools"
  tags:
    - neutrons-multi-builder
# gitlab-ci.yml
# This file holds the GitLab CI/CD pipeline workflow


job_noop:
  stage: 1up_submodule
  extends: .zoro
workflow:
  rules:
    - { if: '$CI_PIPELINE_SOURCE == "web"', when: never }
    - when: always
    - !reference [.workflow_rules, rules]

stages:
  - 0_start
  - 1_submodule

job_submodule_update:
  stage: 1up_submodule
  extends: .zoro
  variables: { GIT_STRATEGY: clone }
  rules:
    - { if: '$CI_PIPELINE_SOURCE == "web"', when: never }
    - changes:
        - '[^.]*.yml'

.manual_deploy:
  stage: 2up_deploy
  when: manual
  variables: { Z_CI_JOB_NAME: "job_deploy_select, job_syndicate" }
  trigger: { project: sns-hfir-scse/deployments/conda-deploy, branch: main, strategy: depend }
  rules:
    - if: '$CI_PIPELINE_SOURCE == "web"'

job_manual_i_deploy_dev:  { extends: .manual_deploy, variables: { Z_CONDA_ENV: scd-reduction-tools-dev } }
job_manual_j_deploy_qa:   { extends: .manual_deploy, variables: { Z_CONDA_ENV: scd-reduction-tools-qa  } }
job_manual_k_deploy_prod: { extends: .manual_deploy, variables: { Z_CONDA_ENV: scd-reduction-tools     } }
include:
  - project: 'sns-hfir-scse/deployments/conda-deploy'
    file:
      - '.gitlab/workflows/workflow.rules.yml'
      - '.gitlab/workflows/job.noop.yml'
      - '.gitlab/workflows/job.submodule.update.yml'
    ref: borealis-submodules


job_deploy_select_dev:
  stage: 2up_deploy
  extends: .zoro
  variables: { Z_CONDA_ENV: scd-reduction-tools-dev }
# This hidden job holds the rule that evaluates if the submodule update
# shuold be run.  It only runs on a change to one of the recipe files.
.blueprint:
  rules:
    - { if: '$CI_PIPELINE_SOURCE == "web"', when: never }
    - changes:
    - if: '$CI_PIPELINE_SOURCE == "push"'
      changes:
        - 'scd-reduction-tools-dev.yml'


job_deploy_select_qa:
  stage: 2up_deploy
  extends: .zoro
  variables: { Z_CONDA_ENV: scd-reduction-tools-qa }
  rules:
    - { if: '$CI_PIPELINE_SOURCE == "web"', when: never }
    - changes:
        - 'scd-reduction-tools-qa.yml'
        - 'scd-reduction-tools.yml'


job_deploy_select_prod:
  stage: 2up_deploy
  extends: .zoro
  variables: { Z_CONDA_ENV: scd-reduction-tools }
  rules:
    - { if: '$CI_PIPELINE_SOURCE == "web"', when: never }
    - changes:
        - 'scd-reduction-tools.yml'
# This job is required in case there are no other jobs defined.  The noop
# functionality is provided by extending .job_noop from the job.noop.yml file
job_noop_surge:
  stage: 0_start
  extends: .job_noop
  tags: [ 'scse-runner' ]


job_syndicate:
  stage: 4up_syndicate
  extends: .zoro
  needs:
    - { job: job_deploy_select_dev,  optional: true }
    - { job: job_deploy_select_qa,   optional: true }
    - { job: job_deploy_select_prod, optional: true }
  rules:
    - { if: '$CI_PIPELINE_SOURCE == "web"', when: never }
    - changes:
        - '[^.]*.yml'
# This job triggers the conda-deploy pipelin to perform a job_submodule_update.
# The submodule update functionality is provided by extending .job_submodule_update
# from the job.submodule.update.yml file.
job_submodule_update_scd-reduction-tools:
  stage: 1_submodule
  extends: .job_submodule_update