diff --git a/.github/workflows/create-release-branch.yaml b/.github/workflows/create-release-branch.yaml index 3dbe9531735..e38254ac29f 100644 --- a/.github/workflows/create-release-branch.yaml +++ b/.github/workflows/create-release-branch.yaml @@ -1,4 +1,4 @@ -name: Create Release Branch +name: Create Release Branch and Pin System Tests on: push: @@ -37,13 +37,12 @@ jobs: id: define-release-branch run: | TAG=${{ steps.determine-tag.outputs.tag }} - echo "branch=test/${TAG%.0}.x" >> "$GITHUB_OUTPUT" # TODO: change back to release/ branch after testing + echo "branch=release/${TAG%.0}.x" >> "$GITHUB_OUTPUT" - - name: Checkout dd-trace-java at tag + - name: Check out repo at tag uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 - # TODO: uncomment after testing - # with: - # ref: ${{ steps.determine-tag.outputs.tag }} + with: + ref: ${{ steps.determine-tag.outputs.tag }} - name: Check if branch already exists id: check-release-branch @@ -76,7 +75,7 @@ jobs: scope: DataDog/dd-trace-java policy: self.pin-system-tests.create-pr - - name: Checkout dd-trace-java at release branch + - name: Check out repo at release branch uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 with: ref: ${{ needs.create-release-branch.outputs.release-branch-name }} @@ -86,7 +85,7 @@ jobs: run: | echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Define pin-system-tests branch name + - 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 diff --git a/.github/workflows/pin-system-tests.yaml b/.github/workflows/pin-system-tests.yaml deleted file mode 100644 index 5d82db5e3ba..00000000000 --- a/.github/workflows/pin-system-tests.yaml +++ /dev/null @@ -1,113 +0,0 @@ -name: Pin system tests - -on: - workflow_dispatch: - inputs: - release-branch-name: - description: 'The minor release branch name (e.g. release/v1.54.x)' - required: true - type: string - # run workflow when any branch is created - create: - -jobs: - # TODO: Remove this job after confirming the github.ref when a release branch is created - print-github-ref: - name: "Print full github.ref" - runs-on: ubuntu-latest - steps: - - name: Print github.ref - run: | - echo "github.ref: ${{ github.ref }}" - - pin-system-tests: - name: "Pin system tests" - if: github.event_name != 'create' || contains(github.ref, 'release/v') - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write # required for OIDC token federation - steps: - - uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3 - id: octo-sts - with: - scope: DataDog/dd-trace-java - policy: self.pin-system-tests.create-pr - - - name: Define base branch - id: define-base-branch - run: | - if [[ -n "${{ github.event.inputs.release-branch-name }}" ]]; then - BASE_BRANCH=${{ github.event.inputs.release-branch-name }} - else - BASE_BRANCH=${GITHUB_REF#refs/heads/} - fi - echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT - - - name: Checkout the 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 - id: get-latest-commit-sha - run: | - echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - - name: Define branch name - id: define-branch - run: echo "branch=ci/pin-system-tests-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - - - name: Check if branch already exists - id: check-branch - run: | - BRANCH=${{ steps.define-branch.outputs.branch }} - 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 on 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 - id: create-commit - 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 - echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - - name: Push changes - uses: DataDog/commit-headless@05d7b7ee023e2c7d01c47832d420c2503cd416f3 # action/v2.0.3 - with: - token: "${{ steps.octo-sts.outputs.token }}" - branch: "${{ steps.define-branch.outputs.branch }}" - head-sha: "${{ steps.get-latest-commit-sha.outputs.sha }}" - create-branch: true - command: push - commits: "${{ steps.create-commit.outputs.commit }}" - - - name: Create pull request - env: - GH_TOKEN: ${{ steps.octo-sts.outputs.token }} - run: | - gh pr create --title "Pin system tests for release branch" \ - --base ${{ steps.define-base-branch.outputs.base_branch }} \ - --head ${{ steps.define-branch.outputs.branch }} \ - --label "tag: dependencies" \ - --label "tag: no release notes" \ - --body "This PR pins the system-tests reference for the release branch." \