-
Notifications
You must be signed in to change notification settings - Fork 337
Add pin system tests workflow #10173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
df84fee
Add pin system tests workflow
sarahchen6 f2cb0dd
Add testing trigger
sarahchen6 c4421ba
Merge branch 'master' into sarahchen6/pin-system-tests-workflow
sarahchen6 19c33c5
Merge branch 'master' into sarahchen6/pin-system-tests-workflow
sarahchen6 2a2a8ea
Try peter-evans/create-pull-request
sarahchen6 032688d
Revert "Try peter-evans/create-pull-request"
sarahchen6 3b088c0
Merge branch 'master' into sarahchen6/pin-system-tests-workflow
sarahchen6 1cd0e1a
Hard code release base branch
sarahchen6 7ed86ca
Create and push branch in one step
sarahchen6 d60e55c
Make draft
sarahchen6 ff05ba7
Merge branch 'master' into sarahchen6/pin-system-tests-workflow
sarahchen6 50aa6d5
Missing slash
sarahchen6 a10eaad
Merge branch 'master' into sarahchen6/pin-system-tests-workflow
sarahchen6 4f539e2
Change workflow trigger to release branch creation
sarahchen6 3c43b8e
Refine trust policy
sarahchen6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| name: Pin system tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'The minor release branch name (e.g. release/v1.54.x)' | ||
| required: true | ||
| type: string | ||
| # run workflow when a release branch is created | ||
| create: | ||
|
|
||
| jobs: | ||
| pin-system-tests: | ||
| name: "Pin system tests" | ||
| # CHANGE BACK TO release/v* | ||
| if: github.event_name != 'create' || startsWith(github.ref, 'refs/heads/test/v') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # may not be needed | ||
| 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: Checkout the repository | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - 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 "creating_new_branch=false" >> "$GITHUB_OUTPUT" | ||
| echo "Branch $BRANCH already exists - please delete it and re-run the workflow." | ||
| exit 0 | ||
| else | ||
| echo "creating_new_branch=true" >> "$GITHUB_OUTPUT" | ||
| 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 "No changes to commit, exiting." | ||
| echo "commit_changes=false" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
| else | ||
| echo "commit_changes=true" >> "$GITHUB_OUTPUT" | ||
| echo "Changes to commit:" | ||
| git status -s | ||
| fi | ||
|
|
||
| - name: Commit changes | ||
| if: steps.check-changes.outputs.commit_changes == 'true' | ||
| 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@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1 | ||
| if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true' | ||
| with: | ||
| token: "${{ steps.octo-sts.outputs.token }}" | ||
| branch: "${{ steps.define-branch.outputs.branch }}" | ||
| head-sha: "${{ github.sha }}" | ||
| create-branch: true | ||
| command: push | ||
| commits: "${{ steps.create-commit.outputs.commit }}" | ||
|
|
||
| - name: Define base branch | ||
| id: define-base-branch | ||
| run: | | ||
| if [[ -n "${{ github.event.inputs.tag }}" ]]; then | ||
| BASE_BRANCH=${{ github.event.inputs.tag }} | ||
| else | ||
| BASE_BRANCH=${GITHUB_REF#refs/heads/} | ||
| fi | ||
| echo "base_branch=${BASE_BRANCH}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create pull request | ||
| if: steps.check-changes.outputs.commit_changes == 'true' && steps.check-branch.outputs.creating_new_branch == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ steps.octo-sts.outputs.token }} | ||
| # REMOVE DRAFT | ||
| 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." \ | ||
| --draft | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exiting the workflow