Browse Source

gitlab-ci: name pipelines

This makes it easier to see pipeline reasons in the web UI.

Co-authored-by: Brad King <[email protected]>
Ben Boeckel 1 month ago
parent
commit
fff061d1e7
1 changed files with 12 additions and 0 deletions
  1. 12 0
      .gitlab/rules.yml

+ 12 - 0
.gitlab/rules.yml

@@ -42,8 +42,12 @@
 ##     Set to the name of the staging branch where continuous pipelines run.
 ##     Set to the name of the staging branch where continuous pipelines run.
 ####
 ####
 
 
+variables:
+    CMAKE_CI_PIPELINE_NAME: 'Branch "$CI_COMMIT_REF_NAME"'
+
 # When to even consider running a pipeline.
 # When to even consider running a pipeline.
 workflow:
 workflow:
+    name: "$CMAKE_CI_PIPELINE_NAME"
     rules:
     rules:
         # Run for merge requests.
         # Run for merge requests.
         - if: '$CI_MERGE_REQUEST_ID'
         - if: '$CI_MERGE_REQUEST_ID'
@@ -51,6 +55,8 @@ workflow:
           auto_cancel:
           auto_cancel:
               # Cancel all pipeline jobs if a new commit comes in on the branch/tag.
               # Cancel all pipeline jobs if a new commit comes in on the branch/tag.
               on_new_commit: interruptible
               on_new_commit: interruptible
+          variables:
+              CMAKE_CI_PIPELINE_NAME: 'Merge request !$CI_MERGE_REQUEST_IID'
         # If this is not a MR, do not run for other projects.
         # If this is not a MR, do not run for other projects.
         - if: '$CI_PROJECT_PATH != "cmake/cmake" && $CMAKE_CI_PROJECT_CONTINUOUS_BRANCH == null && $CMAKE_CI_PROJECT_MAIN_BRANCH == null'
         - if: '$CI_PROJECT_PATH != "cmake/cmake" && $CMAKE_CI_PROJECT_CONTINUOUS_BRANCH == null && $CMAKE_CI_PROJECT_MAIN_BRANCH == null'
           when: never
           when: never
@@ -60,15 +66,21 @@ workflow:
           auto_cancel:
           auto_cancel:
               # Never cancel scheduled pipelines because of new commits.
               # Never cancel scheduled pipelines because of new commits.
               on_new_commit: none
               on_new_commit: none
+          variables:
+              CMAKE_CI_PIPELINE_NAME: 'Schedule "$CI_PIPELINE_SCHEDULE_DESCRIPTION"'
         # Run for protected branches.
         # Run for protected branches.
         - if: '$CI_COMMIT_REF_PROTECTED == "true"'
         - if: '$CI_COMMIT_REF_PROTECTED == "true"'
           when: always
           when: always
           auto_cancel:
           auto_cancel:
               # Cancel all pipeline jobs if a new commit comes in on the branch.
               # Cancel all pipeline jobs if a new commit comes in on the branch.
               on_new_commit: interruptible
               on_new_commit: interruptible
+          variables:
+              CMAKE_CI_PIPELINE_NAME: 'Protected branch "$CI_COMMIT_REF_NAME"'
         # Run for tags.
         # Run for tags.
         - if: '$CI_COMMIT_TAG'
         - if: '$CI_COMMIT_TAG'
           when: always
           when: always
+          variables:
+              CMAKE_CI_PIPELINE_NAME: 'Tag "$CI_COMMIT_TAG"'
         # Skip pipelines in all other cases.
         # Skip pipelines in all other cases.
         - when: never
         - when: never