]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Allow pushing branches and tags to customer git repos
authorNicki Křížek <nicki@isc.org>
Tue, 25 Mar 2025 15:51:24 +0000 (16:51 +0100)
committerNicki Křížek <nicki@isc.org>
Wed, 2 Apr 2025 11:04:33 +0000 (11:04 +0000)
For pipelines in the private repository, add an optional manual job,
which allows the current branch to be pushed into the specified
customer's git repository. This can be useful to provide patch previews
for early testing.

For tags created in a private repository, add a manual job which pushes
the created tag to all entitled customers.

(cherry picked from commit 378b412e94a40ee74ab5c9edfb3a2059612a59ff)

.gitlab-ci.yml

index 945f5d774db50c12de286d9355c87695d5097b09..14aa850a49a4294a48c812ad519f73de7f747d89 100644 (file)
@@ -700,6 +700,47 @@ release:
       - "*.tar.gz"
     expire_in: "1 day"
 
+.customer-git: &customer_git
+  <<: *base_image
+  stage: release
+  when: manual
+  variables:  # ensure clean git environment and sufficient history
+    GIT_STRATEGY: clone
+    GIT_DEPTH: 1000
+
+# To trigger this job and push a branch to a customer, you must set the
+# CUSTOMER job variable by clicking on the manual job (not the play button) and
+# set it to the name of the target customer.
+customer-git:branch:
+  <<: *customer_git
+  needs: []
+  rules:
+    - if: '$CI_PROJECT_NAMESPACE == "isc-private" && $CI_PIPELINE_SOURCE == "merge_request_event"'
+      variables:
+        BRANCH: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME'
+    - if: '$CI_PROJECT_NAMESPACE == "isc-private" && $CI_PIPELINE_SOURCE =~ /^(api|pipeline|trigger|web)$/'
+      variables:
+        BRANCH: '$CI_COMMIT_BRANCH'
+  before_script:
+    - test -n "$CUSTOMER"
+    - git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git
+  script:
+    - git checkout -b "$BRANCH"  # ensure refs/heads/$BRANCH exists; GitLab clones with detached HEAD
+    - bind9-qa/releng/push_to_customer_repository.py --branch "$BRANCH" --customer "$CUSTOMER" --force
+
+customer-git:tag:
+  <<: *customer_git
+  needs:
+    - job: release
+      artifacts: false
+  rules:
+    - if: '$CI_PROJECT_NAMESPACE == "isc-private" && $CI_COMMIT_TAG != null'
+  before_script:
+    - git clone --depth 1 https://gitlab.isc.org/isc-projects/bind9-qa.git
+    - git clone --depth 1 "https://token:${ISC_CUSTOMERS_WRITE_TOKEN}@gitlab.isc.org/isc-customers/isc-customer-settings.git"
+  script:
+    - bind9-qa/releng/push_to_customer_repository.py --tag "$CI_COMMIT_TAG" --entitlements isc-customer-settings/entitlements.yaml --force
+
 # Coverity Scan analysis upload
 
 .coverity_cache_prep: &coverity_cache_prep