From 7677b34661e06baec7f2be4f972c1e150a904cf6 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Wed, 22 Sep 2021 09:57:22 -0400
Subject: [PATCH] use "rules" instead of "only" because gitlab says "only" is
 abandoned

---
 .gitlab-ci.yml | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6b2a7fdc..6457a5e8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -82,11 +82,15 @@ system-tests:
       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.
+# Update the staging deployment - only on a commit to the staging 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 == "staging"'
   environment:
     # You can find some status information about environments in GitLab at
     # https://whetstone.privatestorage.io/privatestorage/PrivateStorageio/-/environments.
@@ -100,11 +104,16 @@ update-staging:
     # button...  Still, discoverability or something.
     url: "https://monitoring.privatestorage-staging.com/"
 
-# Update the production deployment - only on a merge to the production branch.
+# 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"
-- 
GitLab