Skip to content

Commit

Permalink
[Internal] Migrate workflows that need write access to use hosted run…
Browse files Browse the repository at this point in the history
…ners (#4377)

Fixes #4376.

Supersedes #4080.

Note: the YAML files were unformatted; please review with "hide
whitespace".
  • Loading branch information
pietern authored Jan 6, 2025
1 parent 1b429c3 commit 9f7bebe
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco

strategy:
fail-fast: false
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/external-message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ on:

jobs:
comment-on-pr:
runs-on: ubuntu-latest
runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco

permissions:
pull-requests: write

Expand Down Expand Up @@ -44,13 +47,13 @@ jobs:
gh pr comment ${{ github.event.pull_request.number }} --body \
"<!-- INTEGRATION_TESTS_MANUAL -->
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:
Trigger:
[go/deco-tests-run/terraform](https://go/deco-tests-run/terraform)
Inputs:
* PR number: ${{github.event.pull_request.number}}
* Commit SHA: \`${{ env.COMMIT_SHA }}\`
Checks will be approved automatically on success.
"
36 changes: 24 additions & 12 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ on:
types: [opened, synchronize]

merge_group:


jobs:
check-token:
name: Check secrets access
runs-on: ubuntu-latest

runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco

environment: "test-trigger-is"
outputs:
has_token: ${{ steps.set-token-status.outputs.has_token }}
Expand All @@ -26,14 +30,18 @@ jobs:
echo "DECO_WORKFLOW_TRIGGER_APP_ID is set. User has access to secrets."
echo "::set-output name=has_token::true"
fi
trigger-tests:
name: Trigger Tests
runs-on: ubuntu-latest

runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco

needs: check-token
if: github.event_name == 'pull_request' && needs.check-token.outputs.has_token == 'true'
environment: "test-trigger-is"

steps:
- uses: actions/checkout@v3

Expand All @@ -45,28 +53,32 @@ jobs:
private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }}
owner: ${{ secrets.ORG_NAME }}
repositories: ${{secrets.REPO_NAME}}

- name: Trigger Workflow in Another Repo
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
gh workflow run terraform-isolated-pr.yml -R ${{ secrets.ORG_NAME }}/${{secrets.REPO_NAME}} \
--ref main \
-f pull_request_number=${{ github.event.pull_request.number }} \
-f commit_sha=${{ github.event.pull_request.head.sha }}
-f commit_sha=${{ github.event.pull_request.head.sha }}
# Statuses and checks apply to specific commits (by hash).
# Statuses and checks apply to specific commits (by hash).
# Enforcement of required checks is done both at the PR level and the merge queue level.
# In case of multiple commits in a single PR, the hash of the squashed commit
# In case of multiple commits in a single PR, the hash of the squashed commit
# will not match the one for the latest (approved) commit in the PR.
# We auto approve the check for the merge queue for two reasons:
# * Queue times out due to duration of tests.
# * Avoid running integration tests twice, since it was already run at the tip of the branch before squashing.
auto-approve:
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest

runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco

steps:
- name: Mark Check
env:
Expand All @@ -77,4 +89,4 @@ jobs:
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/statuses/${{ github.sha }} \
-f 'state=success' \
-f 'context=Integration Tests Check'
-f 'context=Integration Tests Check'
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ on:

jobs:
goreleaser:
runs-on: ubuntu-latest
runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit 9f7bebe

Please sign in to comment.