Skip to content

Commit dbce21a

Browse files
Move CI to Databricks protected runners with JFrog OIDC (#348)
## Summary - Add `.github/actions/setup-jfrog` composite action for OIDC-based JFrog authentication (configures GOPROXY and `.netrc` for Go module proxy) - Switch all workflow jobs (`lint`, `build-and-test`, `dco-check`) from `ubuntu-latest` to `databricks-protected-runner-group` - Add `id-token: write` permission for JFrog OIDC token exchange ## Test plan - [ ] DCO check workflow passes on this PR - [ ] Lint job passes with Go modules resolved through JFrog proxy - [ ] Build and test job passes with Go modules resolved through JFrog proxy - [ ] Verify JFrog OIDC token exchange works on protected runners This pull request was AI-assisted by Isaac. Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent 17770f8 commit dbce21a

3 files changed

Lines changed: 51 additions & 4 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Setup JFrog OIDC
2+
description: Obtain a JFrog access token via GitHub OIDC and configure Go to use JFrog as a module proxy
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Get JFrog OIDC token
8+
shell: bash
9+
run: |
10+
set -euo pipefail
11+
ID_TOKEN=$(curl -sLS \
12+
-H "User-Agent: actions/oidc-client" \
13+
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
14+
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=jfrog-github" | jq .value | tr -d '"')
15+
echo "::add-mask::${ID_TOKEN}"
16+
ACCESS_TOKEN=$(curl -sLS -XPOST -H "Content-Type: application/json" \
17+
"https://databricks.jfrog.io/access/api/v1/oidc/token" \
18+
-d "{\"grant_type\": \"urn:ietf:params:oauth:grant-type:token-exchange\", \"subject_token_type\":\"urn:ietf:params:oauth:token-type:id_token\", \"subject_token\": \"${ID_TOKEN}\", \"provider_name\": \"github-actions\"}" | jq .access_token | tr -d '"')
19+
echo "::add-mask::${ACCESS_TOKEN}"
20+
if [ -z "$ACCESS_TOKEN" ] || [ "$ACCESS_TOKEN" = "null" ]; then
21+
echo "FAIL: Could not extract JFrog access token"
22+
exit 1
23+
fi
24+
echo "JFROG_ACCESS_TOKEN=${ACCESS_TOKEN}" >> "$GITHUB_ENV"
25+
echo "JFrog OIDC token obtained successfully"
26+
27+
- name: Configure Go
28+
shell: bash
29+
run: |
30+
set -euo pipefail
31+
echo "GOPROXY=https://databricks.jfrog.io/artifactory/api/go/db-golang,direct" >> "$GITHUB_ENV"
32+
echo "GONOSUMDB=*" >> "$GITHUB_ENV"
33+
printf "machine databricks.jfrog.io\nlogin gha-service-account\npassword %s\n" "${JFROG_ACCESS_TOKEN}" > ~/.netrc
34+
chmod 600 ~/.netrc
35+
echo "Go configured to use JFrog registry"

.github/workflows/dco-check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ permissions:
1010

1111
jobs:
1212
dco-check:
13-
runs-on: ubuntu-latest
13+
runs-on:
14+
group: databricks-protected-runner-group
15+
labels: linux-ubuntu-latest
1416
name: Check DCO Sign-off
1517
steps:
1618
- name: Checkout

.github/workflows/go.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ on:
88

99
permissions:
1010
contents: read
11+
id-token: write
1112

1213
jobs:
1314
lint:
1415
name: Lint
15-
runs-on: ubuntu-latest
16+
runs-on:
17+
group: databricks-protected-runner-group
18+
labels: linux-ubuntu-latest
1619

1720
steps:
1821
- name: Check out code into the Go module directory
1922
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2023

24+
- name: Setup JFrog
25+
uses: ./.github/actions/setup-jfrog
26+
2127
- name: Set up Go Toolchain
2228
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
2329
with:
@@ -33,13 +39,17 @@ jobs:
3339
strategy:
3440
matrix:
3541
go-version: [1.20.x]
36-
os: [ubuntu-latest]
37-
runs-on: ubuntu-latest
42+
runs-on:
43+
group: databricks-protected-runner-group
44+
labels: linux-ubuntu-latest
3845

3946
steps:
4047
- name: Check out code into the Go module directory
4148
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
4249

50+
- name: Setup JFrog
51+
uses: ./.github/actions/setup-jfrog
52+
4353
- name: Set up Go Toolchain
4454
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
4555
with:

0 commit comments

Comments
 (0)