From 99c60bd22d7ad12149b5bc78acd46f85c5a6f7d9 Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Mon, 2 Feb 2026 14:36:12 -0500 Subject: [PATCH 1/4] Change pin-system-tests workflow trigger to release tag --- .github/workflows/pin-system-tests.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pin-system-tests.yaml b/.github/workflows/pin-system-tests.yaml index 5d82db5e3ba..25fab505e89 100644 --- a/.github/workflows/pin-system-tests.yaml +++ b/.github/workflows/pin-system-tests.yaml @@ -7,11 +7,11 @@ on: description: 'The minor release branch name (e.g. release/v1.54.x)' required: true type: string - # run workflow when any branch is created + # run workflow when any branch or tag is created create: jobs: - # TODO: Remove this job after confirming the github.ref when a release branch is created + # TODO: Remove this job after confirming the workflow succeeds for release branches print-github-ref: name: "Print full github.ref" runs-on: ubuntu-latest @@ -22,7 +22,7 @@ jobs: pin-system-tests: name: "Pin system tests" - if: github.event_name != 'create' || contains(github.ref, 'release/v') + if: github.event_name != 'create' || (contains(github.ref, 'tags/v') && endsWith(github.ref, '.0')) runs-on: ubuntu-latest permissions: contents: write @@ -40,7 +40,14 @@ jobs: if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then BASE_BRANCH=${{ github.event.inputs.release-branch-name }} else - BASE_BRANCH=${GITHUB_REF#refs/heads/} + # Convert tag (e.g. v1.54.0) to release branch name (e.g. release/v1.54.x) + TAG=${GITHUB_REF#refs/tags/} + if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then + BASE_BRANCH="release/${TAG%.0}.x" + else + echo "ERROR: Tag $TAG is not in the expected format: vX.Y.0" + exit 1 + fi fi echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT From 4e1629ca8753f7532eb8fcc0c37dc4fadc7a519d Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Tue, 3 Feb 2026 10:42:05 -0500 Subject: [PATCH 2/4] Clarify step names --- .github/workflows/pin-system-tests.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pin-system-tests.yaml b/.github/workflows/pin-system-tests.yaml index 25fab505e89..25a58c89cf4 100644 --- a/.github/workflows/pin-system-tests.yaml +++ b/.github/workflows/pin-system-tests.yaml @@ -34,7 +34,7 @@ jobs: scope: DataDog/dd-trace-java policy: self.pin-system-tests.create-pr - - name: Define base branch + - name: Define base release branch id: define-base-branch run: | if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then @@ -51,21 +51,21 @@ jobs: fi echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT - - name: Checkout the repository + - name: Checkout the dd-trace-java repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ steps.define-base-branch.outputs.base_branch }} - - name: Get latest commit SHA of base branch + - name: Get latest commit SHA of base release branch id: get-latest-commit-sha run: | echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Define branch name + - name: Define pin-system-tests branch name id: define-branch run: echo "branch=ci/pin-system-tests-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - - name: Check if branch already exists + - name: Check if pin-system-tests branch already exists id: check-branch run: | BRANCH=${{ steps.define-branch.outputs.branch }} From e685c5af9cea57e6623a432894fefe0ec904dc2e Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Tue, 3 Feb 2026 16:02:15 -0500 Subject: [PATCH 3/4] Use workflow_run.head_sha to find corresponding tag --- .github/workflows/pin-system-tests.yaml | 38 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pin-system-tests.yaml b/.github/workflows/pin-system-tests.yaml index 25a58c89cf4..642b807cddf 100644 --- a/.github/workflows/pin-system-tests.yaml +++ b/.github/workflows/pin-system-tests.yaml @@ -7,8 +7,10 @@ on: description: 'The minor release branch name (e.g. release/v1.54.x)' required: true type: string - # run workflow when any branch or tag is created - create: + workflow_run: + workflows: [Create Release Branch] + types: + - completed jobs: # TODO: Remove this job after confirming the workflow succeeds for release branches @@ -22,7 +24,7 @@ jobs: pin-system-tests: name: "Pin system tests" - if: github.event_name != 'create' || (contains(github.ref, 'tags/v') && endsWith(github.ref, '.0')) + if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest permissions: contents: write @@ -34,20 +36,34 @@ jobs: scope: DataDog/dd-trace-java policy: self.pin-system-tests.create-pr + - name: Checkout repository for tag lookup + if: github.event_name == 'workflow_run' + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 + with: + fetch-depth: 0 # fetch entire history, including tags + + - name: Get release branch name from tag + if: github.event_name == 'workflow_run' + id: get-release-branch + run: | + HEAD_SHA="${{ github.event.workflow_run.head_sha }}" + TAG=$(git tag --points-at "$HEAD_SHA" | grep -E '^v[0-9]+\.[0-9]+\.0$' | head -n 1) + if [[ -z "$TAG" ]]; then + echo "ERROR: Could not find tag that matches pattern 'vX.Y.0' and points at commit $HEAD_SHA" + exit 1 + fi + echo "branch=release/${TAG%.0}.x" >> $GITHUB_OUTPUT + - name: Define base release branch id: define-base-branch run: | if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then BASE_BRANCH=${{ github.event.inputs.release-branch-name }} + elif [[ "${{ github.event_name }}" == "workflow_run" ]]; then + BASE_BRANCH="${{ steps.get-release-branch.outputs.branch }}" else - # Convert tag (e.g. v1.54.0) to release branch name (e.g. release/v1.54.x) - TAG=${GITHUB_REF#refs/tags/} - if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then - BASE_BRANCH="release/${TAG%.0}.x" - else - echo "ERROR: Tag $TAG is not in the expected format: vX.Y.0" - exit 1 - fi + echo "ERROR: Unable to determine base branch." + exit 1 fi echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT From 75adc56e0ca1debebfbb0165dfefd20321e36e9f Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Tue, 3 Feb 2026 16:47:00 -0500 Subject: [PATCH 4/4] Use repository_dispatch --- .github/workflows/create-release-branch.yaml | 8 +++++ .github/workflows/pin-system-tests.yaml | 32 ++++---------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/.github/workflows/create-release-branch.yaml b/.github/workflows/create-release-branch.yaml index 37914638471..d5562a02932 100644 --- a/.github/workflows/create-release-branch.yaml +++ b/.github/workflows/create-release-branch.yaml @@ -59,3 +59,11 @@ jobs: run: | git checkout -b "${{ steps.define-branch.outputs.branch }}" git push -u origin "${{ steps.define-branch.outputs.branch }}" + + - name: Dispatch repository event to pin system tests + if: steps.check-branch.outputs.creating_new_branch == 'true' + uses: peter-evans/repository-dispatch@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + event-type: pin-system-tests + client-payload: '{"release-branch-name": "${{ steps.define-branch.outputs.branch }}"}' diff --git a/.github/workflows/pin-system-tests.yaml b/.github/workflows/pin-system-tests.yaml index 642b807cddf..742bda1a319 100644 --- a/.github/workflows/pin-system-tests.yaml +++ b/.github/workflows/pin-system-tests.yaml @@ -7,10 +7,8 @@ on: description: 'The minor release branch name (e.g. release/v1.54.x)' required: true type: string - workflow_run: - workflows: [Create Release Branch] - types: - - completed + repository_dispatch: + types: [pin-system-tests] jobs: # TODO: Remove this job after confirming the workflow succeeds for release branches @@ -24,7 +22,6 @@ jobs: pin-system-tests: name: "Pin system tests" - if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest permissions: contents: write @@ -36,33 +33,16 @@ jobs: scope: DataDog/dd-trace-java policy: self.pin-system-tests.create-pr - - name: Checkout repository for tag lookup - if: github.event_name == 'workflow_run' - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 - with: - fetch-depth: 0 # fetch entire history, including tags - - - name: Get release branch name from tag - if: github.event_name == 'workflow_run' - id: get-release-branch - run: | - HEAD_SHA="${{ github.event.workflow_run.head_sha }}" - TAG=$(git tag --points-at "$HEAD_SHA" | grep -E '^v[0-9]+\.[0-9]+\.0$' | head -n 1) - if [[ -z "$TAG" ]]; then - echo "ERROR: Could not find tag that matches pattern 'vX.Y.0' and points at commit $HEAD_SHA" - exit 1 - fi - echo "branch=release/${TAG%.0}.x" >> $GITHUB_OUTPUT - - name: Define base release branch id: define-base-branch run: | if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then BASE_BRANCH=${{ github.event.inputs.release-branch-name }} - elif [[ "${{ github.event_name }}" == "workflow_run" ]]; then - BASE_BRANCH="${{ steps.get-release-branch.outputs.branch }}" else - echo "ERROR: Unable to determine base branch." + BASE_BRANCH="${{ github.event.client_payload.release-branch-name }}" + fi + if [[ -z "$BASE_BRANCH" ]]; then + echo "ERROR: Could not determine release branch" exit 1 fi echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT