Skip to content

chore: Update Gradle dependencies (#12419) #32

chore: Update Gradle dependencies (#12419)

chore: Update Gradle dependencies (#12419) #32

name: Create Release Branch and Pin System Tests
on:
push:
tags:
- 'v[0-9]+.[0-9]+.0' # Trigger on minor release tags (e.g. v1.54.0)
workflow_dispatch:
inputs:
tag:
description: 'The minor release tag (e.g. v1.54.0)'
required: true
type: string
jobs:
create-release-branch:
runs-on: ubuntu-latest
permissions:
contents: write # Allow pushing the release branch
outputs:
release-branch-name: ${{ steps.define-release-branch.outputs.branch }}
steps:
- name: Determine tag
id: determine-tag
env:
INPUT_TAG: ${{ github.event.inputs.tag }}
run: |
if [ -n "$INPUT_TAG" ]; then
TAG="$INPUT_TAG"
else
TAG="${GITHUB_REF#refs/tags/}"
fi
if ! [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then
echo "Error: Tag $TAG is not in the expected format: vX.Y.0"
exit 1
fi
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Define release branch name from tag
id: define-release-branch
env:
TAG: ${{ steps.determine-tag.outputs.tag }}
run: |
echo "branch=release/${TAG%.0}.x" >> "$GITHUB_OUTPUT"
- name: Check out repo at tag
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
ref: ${{ steps.determine-tag.outputs.tag }}
- name: Check if branch already exists
id: check-release-branch
env:
BRANCH: ${{ steps.define-release-branch.outputs.branch }}
run: |
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
echo "Branch $BRANCH already exists - skipping creation"
else
echo "creating_new_branch=true" >> "$GITHUB_OUTPUT"
echo "Branch $BRANCH does not exist - creating it now"
fi
- name: Create and push release branch
if: steps.check-release-branch.outputs.creating_new_branch == 'true'
env:
BRANCH: ${{ steps.define-release-branch.outputs.branch }}
run: |
git checkout -b "$BRANCH"
git push -u origin "$BRANCH"
pin-system-tests:
needs: create-release-branch
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # required for OIDC token federation
steps:
- uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
id: octo-sts
with:
scope: DataDog/dd-trace-java
policy: self.pin-system-tests.create-pr
- name: Check out repo at release branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
ref: ${{ needs.create-release-branch.outputs.release-branch-name }}
- 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 pin-system-tests branch name from date
id: define-pin-branch
run: echo "branch=ci/pin-system-tests-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Check if pin-system-tests branch already exists
id: check-pin-branch
env:
BRANCH: ${{ steps.define-pin-branch.outputs.branch }}
run: |
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
echo "ERROR: Branch $BRANCH already exists - please delete it and re-run the workflow."
exit 1
else
echo "Branch $BRANCH does not exist - creating it now."
fi
- name: Update system-tests references to latest commit SHA of system-tests main
run: ./tooling/update_system_test_reference.sh
- name: Check if changes should be committed
id: check-changes
run: |
if [[ -z "$(git status -s)" ]]; then
echo "ERROR: No changes to commit - the system-tests reference was not updated."
exit 1
else
echo "Changes to commit:"
git status -s
fi
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml .gitlab-ci.yml
- name: Push changes
uses: DataDog/commit-headless@2801f6e08acb3a69b6c4d7b0d5deef27c1a15bc7 # action/v3.3.1
with:
token: "${{ steps.octo-sts.outputs.token }}"
branch: "${{ steps.define-pin-branch.outputs.branch }}"
head-sha: "${{ steps.get-latest-commit-sha.outputs.sha }}"
create-branch: true
command: push
- name: Create pull request
env:
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
BASE_BRANCH: ${{ needs.create-release-branch.outputs.release-branch-name }}
HEAD_BRANCH: ${{ steps.define-pin-branch.outputs.branch }}
run: |
gh pr create --title "Pin system tests for release branch" \
--base "$BASE_BRANCH" \
--head "$HEAD_BRANCH" \
--label "tag: dependencies" \
--label "tag: no release notes" \
--body "This PR pins the system-tests reference for the release branch."