diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 481c2961bfe395bccf4d7753304e4351cfc74332..d6b06fae42f6e738725238fac59617aeb161dfd4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,22 +74,47 @@ system-tests: .update-grid: &UPDATE_GRID stage: "deploy" script: | - env --ignore-environment - NIX_PATH=$NIX_PATH GITLAB_USER_LOGIN=$GITLAB_USER_LOGIN CI_JOB_NAME=$CI_JOB_NAME CI_PIPELINE_SOURCE=$CI_PIPELINE_SOURCE CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH ./ci-tools/update-grid-servers "${PRIVATESTORAGEIO_SSH_DEPLOY_KEY_PATH}" "${CI_ENVIRONMENT_NAME}" - -# Update the staging deployment - only on a merge to the staging branch. + env --ignore-environment - \ + NIX_PATH="$NIX_PATH" \ + GITLAB_USER_LOGIN="$GITLAB_USER_LOGIN" \ + CI_JOB_NAME="$CI_JOB_NAME" \ + CI_PIPELINE_SOURCE="$CI_PIPELINE_SOURCE" \ + CI_COMMIT_BRANCH="$CI_COMMIT_BRANCH" \ + ./ci-tools/update-grid-servers "${PRIVATESTORAGEIO_SSH_DEPLOY_KEY_PATH}" "${CI_ENVIRONMENT_NAME}" + +# Update the staging deployment - only on a commit to the develop branch. update-staging: <<: *UPDATE_GRID - only: - - "staging" + # https://docs.gitlab.com/ee/ci/yaml/#rules + rules: + # https://docs.gitlab.com/ee/ci/yaml/index.html#rulesif + # https://docs.gitlab.com/ee/ci/jobs/job_control.html#cicd-variable-expressions + # https://docs.gitlab.com/ee/ci/variables/predefined_variables.html + - if: '$CI_COMMIT_BRANCH == "develop"' environment: + # You can find some status information about environments in GitLab at + # https://whetstone.privatestorage.io/privatestorage/PrivateStorageio/-/environments. name: "staging" - url: "https://privatestorage-staging.com/" - -# Update the production deployment - only on a merge to the production branch. + # The URL controls where the "View Deployment" button for this environment + # will take you. The main website isn't controlled by this codebase so we + # don't point there. The monitoring system *is* controlled by this + # codebase and it also tells us lots of stuff about other things + # controlled by this codebase so that seems like a good place to land. + # Not that I make it a habit to visit the deployment using the GitLab + # button... Still, discoverability or something. + url: "https://monitoring.privatestorage-staging.com/" + +# Update the production deployment - only on a commit to the production branch. deploy-to-production: <<: *UPDATE_GRID - only: - - "production" + # https://docs.gitlab.com/ee/ci/yaml/#rules + rules: + # https://docs.gitlab.com/ee/ci/yaml/index.html#rulesif + # https://docs.gitlab.com/ee/ci/jobs/job_control.html#cicd-variable-expressions + # https://docs.gitlab.com/ee/ci/variables/predefined_variables.html + - if: '$CI_COMMIT_BRANCH == "production"' + environment: + # See notes in `update-staging`. name: "production" - url: "https://privatestorage.io/" + url: "https://monitoring.private.storage/"