Skip to content

Commit 5047920

Browse files
authored
CI (Buildkite, GHA): Allow any user with triage or commit permissions to retry all failed Buildkite jobs (#42138)
1 parent 46453cd commit 5047920

File tree

3 files changed

+63
-9
lines changed

3 files changed

+63
-9
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ CODEOWNERS @JuliaLang/github-actions
22
/.github/ @JuliaLang/github-actions
33
/.buildkite/ @JuliaLang/github-actions
44

5+
/.github/workflows/retry.yml @DilumAluthge
56
/.github/workflows/statuses.yml @DilumAluthge

.github/workflows/retry.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Please ping @DilumAluthge when making any changes to this file.
2+
3+
# Here are some steps that we take in this workflow file for security reasons:
4+
# 1. We do not checkout any code.
5+
# 2. We only run actions that are defined in a repository in the `JuliaLang` GitHub organization.
6+
# 3. We do not give the `GITHUB_TOKEN` any permissions.
7+
# 4. We only give the Buildkite API token (`BUILDKITE_API_TOKEN_RETRY`) the minimum necessary
8+
# set of permissions.
9+
10+
# Important note to Buildkite maintainers:
11+
# In order to make this work, you need to tell Buildkite that it should NOT create a brand-new
12+
# build when someone closes and reopens a pull request. To do so:
13+
# 1. Go to the relevant pipeline (e.g. https://buildkite.com/julialang/julia-master).
14+
# 2. Click on the "Pipeline Settings" button.
15+
# 3. In the left sidebar, under "Pipeline Settings", click on "GitHub".
16+
# 4. In the "GitHub Settings", under "Build Pull Requests", make sure that the "Skip pull
17+
# request builds for existing commits" checkbox is checked. This is the setting that tells
18+
# Buildkite that it should NOT create a brand-new build when someone closes and reopens a
19+
# pull request.
20+
# 5. At the bottom of the page, click the "Save GitHub Settings" button.
21+
22+
name: Retry Failed Buildkite Jobs
23+
24+
on:
25+
# When using the `pull_request_target` event, all PRs will get access to secret environment
26+
# variables (such as the `BUILDKITE_API_TOKEN_RETRY` secret environment variable), even if
27+
# the PR is from a fork. Therefore, for security reasons, we do not checkout any code in
28+
# this workflow.
29+
pull_request_target:
30+
31+
# TODO: delete the following line (once we have completely transitioned from Buildbot to Buildkite)
32+
types: [ reopened, labeled ]
33+
34+
# TODO: uncomment the following line (once we have completely transitioned from Buildbot to Buildkite)
35+
# types: [ reopened ]
36+
37+
# We do not give the `GITHUB_TOKEN` any permissions.
38+
permissions:
39+
statuses: none
40+
41+
jobs:
42+
retry:
43+
name: retry
44+
runs-on: ubuntu-latest
45+
46+
# TODO: delete the following line (once we have completely transitioned from Buildbot to Buildkite)
47+
if: github.repository == 'JuliaLang/julia' && (github.event.label.name == 'Buildkite - retry failed jobs' || github.event.action == 'reopened')
48+
49+
# TODO: uncomment the following line (once we have completely transitioned from Buildbot to Buildkite)
50+
# if: github.repository == 'JuliaLang/julia'
51+
52+
steps:
53+
# For security reasons, we do not checkout any code in this workflow.
54+
- uses: JuliaLang/retry-buildkite@24e8341f74e0d6760717235eac936db639d7e9eb
55+
with:
56+
buildkite_api_token: ${{ secrets.BUILDKITE_API_TOKEN_RETRY }}
57+
buildkite_organization_slug: 'julialang'
58+
buildkite_pipeline_slug: 'julia-master'
59+
pr_number: ${{github.event.number}}

.github/workflows/statuses.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
# This is just a short-term solution until we have migrated all of CI to Buildkite.
44
#
55
# 1. TODO: delete this file once we have migrated all of CI to Buildkite.
6-
#
7-
# 2. TODO: disable GitHub Actions on the `JuliaLang/julia` repository once we have migrated all
8-
# of CI to Buildkite.
96

107
# Here are some steps that we take in this workflow file for security reasons:
118
# 1. We do not checkout any code.
129
# 2. We do not run any external actions.
13-
# 3. We only give `GITHUB_TOKEN` the minimum necessary set of permissions.
10+
# 3. We only give the `GITHUB_TOKEN` the minimum necessary set of permissions.
1411

1512
name: Statuses
1613

@@ -27,7 +24,7 @@ on:
2724
- 'master'
2825
- 'release-*'
2926

30-
# These are the permissions for the `GITHUB_TOKEN` token.
27+
# These are the permissions for the `GITHUB_TOKEN`.
3128
# We should only give the token the minimum necessary set of permissions.
3229
permissions:
3330
statuses: write
@@ -37,15 +34,12 @@ jobs:
3734
name: statuses
3835
runs-on: ubuntu-latest
3936
if: github.repository == 'JuliaLang/julia'
40-
strategy:
41-
fail-fast: false
4237
steps:
38+
# For security reasons, we do not checkout any code in this workflow.
4339
- run: echo "SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
4440
if: github.event_name == 'pull_request_target'
45-
4641
- run: echo "SHA=${{ github.sha }}" >> $GITHUB_ENV
4742
if: github.event_name != 'pull_request_target'
48-
4943
- run: echo "The SHA is ${{ env.SHA }}"
5044

5145
# As we incrementally migrate individual jobs from Buildbot to Buildkite, we should

0 commit comments

Comments
 (0)