From 7b1fe5390c0de95fc630b6c12118c7893960ac05 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Tue, 19 Nov 2024 13:34:43 -0800 Subject: [PATCH 1/8] geomag tag added to jobs --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 846e857e..2a925d3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,6 +50,7 @@ workflow: tags: - deploy - swarm + - geomag #ensures we use geomag-specific- deploy, swarm tagged runners # these variables are defined in Gitlab, or set in scripts/custom.config.sh # variables: # DATABASE_URL @@ -87,6 +88,7 @@ workflow: tags: - deploy - swarm + - geomag #ensures we use geomag-specific- deploy, swarm tagged runners variables: APP_DEPLOY_DIR: "/geomag/geomag-algorithms" REQUIRED_PREFIX: "/geomag" @@ -183,6 +185,7 @@ Test: tags: - deploy - swarm + - geomag #ensures we use geomag-specific- deploy, swarm tagged runners ## -------------------------------------------------- # Integration Stage @@ -223,6 +226,7 @@ Build Docker Image: tags: # TODO: refactor to separate build/publish steps - deploy + - geomag #ensures we use geomag-specific- deploy tagged runners variables: APP_NAME: geomag-algorithms FROM_IMAGE: code.usgs.gov:5001/devops/images/usgs/python:3.10-obspy -- GitLab From 72937c64385c23d41dd53d5ab3afc0f99013ddb1 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Wed, 20 Nov 2024 09:00:56 -0800 Subject: [PATCH 2/8] rule based tags --- .gitlab-ci.yml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2a925d3d..d3b02561 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,10 +47,6 @@ workflow: - export STACK_NAME=${APP_NAME} - ./scripts/deploy.sh stage: deploy - tags: - - deploy - - swarm - - geomag #ensures we use geomag-specific- deploy, swarm tagged runners # these variables are defined in Gitlab, or set in scripts/custom.config.sh # variables: # DATABASE_URL @@ -85,10 +81,6 @@ workflow: git pull --ff-only "${CI_REPOSITORY_URL}" "${CI_COMMIT_REF_NAME}"; fi stage: deploy - tags: - - deploy - - swarm - - geomag #ensures we use geomag-specific- deploy, swarm tagged runners variables: APP_DEPLOY_DIR: "/geomag/geomag-algorithms" REQUIRED_PREFIX: "/geomag" @@ -107,6 +99,10 @@ workflow: if: $CI_PROJECT_PATH != $UPSTREAM_PATH variables: ENVIRONMENT: development + tags: + - deploy + - swarm + - staging01 .staging-env: &staging-env if: > @@ -114,6 +110,10 @@ workflow: && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: ENVIRONMENT: staging + tags: + - deploy + - swarm + - geomag .production-env: &production-env if: > @@ -121,6 +121,11 @@ workflow: && ( $CI_COMMIT_BRANCH == 'production' || $CI_COMMIT_TAG ) variables: ENVIRONMENT: production + tags: + - deploy + - swarm + - geomag + ## -------------------------------------------------- # Init Stage @@ -170,6 +175,10 @@ Lint: stage: test Test: + rules: + - <<: *.development-env + - <<: *.staging-env + - <<: *.production-env artifacts: reports: coverage_report: @@ -182,10 +191,6 @@ Test: - poetry run poe test coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' stage: test - tags: - - deploy - - swarm - - geomag #ensures we use geomag-specific- deploy, swarm tagged runners ## -------------------------------------------------- # Integration Stage @@ -223,10 +228,10 @@ Build Docker Image: - docker push "${PROJECT_IMAGE_NAME}"; stage: integration - tags: - # TODO: refactor to separate build/publish steps - - deploy - - geomag #ensures we use geomag-specific- deploy tagged runners + rules: + - <<: *development-env + - <<: *staging-env + - <<: *production-env variables: APP_NAME: geomag-algorithms FROM_IMAGE: code.usgs.gov:5001/devops/images/usgs/python:3.10-obspy -- GitLab From d9029b5139b3d41e66f0ac5a6fd64ff2186f0b92 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Wed, 20 Nov 2024 09:04:07 -0800 Subject: [PATCH 3/8] rule based tags --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d3b02561..7f23ce1f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -176,9 +176,9 @@ Lint: Test: rules: - - <<: *.development-env - - <<: *.staging-env - - <<: *.production-env + - <<: *development-env + - <<: *staging-env + - <<: *production-env artifacts: reports: coverage_report: -- GitLab From 261cc576ec2e3a0f95a0d3987c82be05db5ca321 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Wed, 20 Nov 2024 10:20:22 -0800 Subject: [PATCH 4/8] workflow based tags --- .gitlab-ci.yml | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f23ce1f..1412543b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,13 +15,14 @@ variables: BRANCH_OR_TAG: :${CI_COMMIT_REF_SLUG} # format looks like ':feature-branch' BRANCH_OR_TAG: ${BRANCH_OR_TAG/:master/:latest} #replaces ':master' with ':latest' DOCKER_AUTH_CONFIG: '{"auths":{"$CI_REGISTRY":{"username":"$CI_REGISTRY_USER","password":"$CI_REGISTRY_PASSWORD"}}}' #Authentication for Docker Executor. - + ENVIRONMENT_TAG: geomag # Do not run in upstream for merge requests workflow: rules: - - if: $CI_COMMIT_TAG - - if: $CI_COMMIT_BRANCH - + - if: $CI_COMMIT_TAG || $CI_COMMIT_BRANCH + - if: $CI_PROJECT_PATH != $UPSTREAM_PATH + variables: + ENVIRONMENT_TAG: staging01 ## -------------------------------------------------- # Templates ## -------------------------------------------------- @@ -99,10 +100,6 @@ workflow: if: $CI_PROJECT_PATH != $UPSTREAM_PATH variables: ENVIRONMENT: development - tags: - - deploy - - swarm - - staging01 .staging-env: &staging-env if: > @@ -110,10 +107,6 @@ workflow: && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: ENVIRONMENT: staging - tags: - - deploy - - swarm - - geomag .production-env: &production-env if: > @@ -121,11 +114,6 @@ workflow: && ( $CI_COMMIT_BRANCH == 'production' || $CI_COMMIT_TAG ) variables: ENVIRONMENT: production - tags: - - deploy - - swarm - - geomag - ## -------------------------------------------------- # Init Stage @@ -175,10 +163,6 @@ Lint: stage: test Test: - rules: - - <<: *development-env - - <<: *staging-env - - <<: *production-env artifacts: reports: coverage_report: @@ -191,6 +175,10 @@ Test: - poetry run poe test coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' stage: test + tags: + - deploy + - swarm + - $ENVIRONMENT_TAG #ensures we use geomag-specific- deploy, swarm tagged runners ## -------------------------------------------------- # Integration Stage @@ -228,10 +216,10 @@ Build Docker Image: - docker push "${PROJECT_IMAGE_NAME}"; stage: integration - rules: - - <<: *development-env - - <<: *staging-env - - <<: *production-env + tags: + # TODO: refactor to separate build/publish steps + - deploy + - $ENVIRONMENT_TAG #ensures we use geomag-specific- deploy, swarm tagged runners variables: APP_NAME: geomag-algorithms FROM_IMAGE: code.usgs.gov:5001/devops/images/usgs/python:3.10-obspy -- GitLab From 62d33d33406d0b101f273579172742203863c524 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Wed, 20 Nov 2024 10:24:36 -0800 Subject: [PATCH 5/8] workflow based tags --- .gitlab-ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1412543b..08bb9f73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,10 +19,14 @@ variables: # Do not run in upstream for merge requests workflow: rules: - - if: $CI_COMMIT_TAG || $CI_COMMIT_BRANCH - - if: $CI_PROJECT_PATH != $UPSTREAM_PATH + - if: $CI_COMMIT_TAG && $CI_PROJECT_PATH != $UPSTREAM_PATH variables: ENVIRONMENT_TAG: staging01 + - if: $CI_COMMIT_BRANCH && $CI_PROJECT_PATH != $UPSTREAM_PATH + variables: + ENVIRONMENT_TAG: staging01 + - if: $CI_COMMIT_TAG || $CI_COMMIT_BRANCH + ## -------------------------------------------------- # Templates ## -------------------------------------------------- -- GitLab From 39926e34b927a8284494c5585dd160c818991b37 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Wed, 20 Nov 2024 10:26:22 -0800 Subject: [PATCH 6/8] workflow based tags --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08bb9f73..1ef8ea9c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,11 +20,11 @@ variables: workflow: rules: - if: $CI_COMMIT_TAG && $CI_PROJECT_PATH != $UPSTREAM_PATH - variables: - ENVIRONMENT_TAG: staging01 + variables: + ENVIRONMENT_TAG: staging01 - if: $CI_COMMIT_BRANCH && $CI_PROJECT_PATH != $UPSTREAM_PATH - variables: - ENVIRONMENT_TAG: staging01 + variables: + ENVIRONMENT_TAG: staging01 - if: $CI_COMMIT_TAG || $CI_COMMIT_BRANCH ## -------------------------------------------------- -- GitLab From fc10b087e6a92a643dc7cc4ee759564b642f0cd3 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Wed, 20 Nov 2024 10:30:09 -0800 Subject: [PATCH 7/8] renamed to GEOMAG_TAG --- .gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1ef8ea9c..c261457f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,16 +15,16 @@ variables: BRANCH_OR_TAG: :${CI_COMMIT_REF_SLUG} # format looks like ':feature-branch' BRANCH_OR_TAG: ${BRANCH_OR_TAG/:master/:latest} #replaces ':master' with ':latest' DOCKER_AUTH_CONFIG: '{"auths":{"$CI_REGISTRY":{"username":"$CI_REGISTRY_USER","password":"$CI_REGISTRY_PASSWORD"}}}' #Authentication for Docker Executor. - ENVIRONMENT_TAG: geomag + GEOMAG_TAG: geomag # Do not run in upstream for merge requests workflow: rules: - if: $CI_COMMIT_TAG && $CI_PROJECT_PATH != $UPSTREAM_PATH variables: - ENVIRONMENT_TAG: staging01 + GEOMAG_TAG: staging01 - if: $CI_COMMIT_BRANCH && $CI_PROJECT_PATH != $UPSTREAM_PATH variables: - ENVIRONMENT_TAG: staging01 + GEOMAG_TAG: staging01 - if: $CI_COMMIT_TAG || $CI_COMMIT_BRANCH ## -------------------------------------------------- @@ -182,7 +182,7 @@ Test: tags: - deploy - swarm - - $ENVIRONMENT_TAG #ensures we use geomag-specific- deploy, swarm tagged runners + - $GEOMAG_TAG #ensures we use geomag-specific- deploy, swarm tagged runners ## -------------------------------------------------- # Integration Stage @@ -223,7 +223,7 @@ Build Docker Image: tags: # TODO: refactor to separate build/publish steps - deploy - - $ENVIRONMENT_TAG #ensures we use geomag-specific- deploy, swarm tagged runners + - $GEOMAG_TAG #ensures we use geomag-specific- deploy, swarm tagged runners variables: APP_NAME: geomag-algorithms FROM_IMAGE: code.usgs.gov:5001/devops/images/usgs/python:3.10-obspy -- GitLab From 35cce81fbb623e559a4bd3248c573f48643faa64 Mon Sep 17 00:00:00 2001 From: Nicholas Shavers <nshavers@contractor.usgs.gov> Date: Wed, 20 Nov 2024 10:34:20 -0800 Subject: [PATCH 8/8] renamed to GEOMAG_TAG --- .gitlab-ci.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c261457f..dee824aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,12 +19,9 @@ variables: # Do not run in upstream for merge requests workflow: rules: - - if: $CI_COMMIT_TAG && $CI_PROJECT_PATH != $UPSTREAM_PATH + - if: ($CI_COMMIT_TAG || $CI_COMMIT_BRANCH) && $CI_PROJECT_PATH != $UPSTREAM_PATH variables: - GEOMAG_TAG: staging01 - - if: $CI_COMMIT_BRANCH && $CI_PROJECT_PATH != $UPSTREAM_PATH - variables: - GEOMAG_TAG: staging01 + GEOMAG_TAG: staging01 #used when geomag tag is unavailable to a developer - if: $CI_COMMIT_TAG || $CI_COMMIT_BRANCH ## -------------------------------------------------- -- GitLab