Skip to content

Commit 64b75cd

Browse files
Switch CI to hardened runners with JFrog Go module proxy (#1609)
## Summary Route Go module downloads through JFrog Artifactory on hardened runners that block direct access to proxy.golang.org. Authenticate via GitHub Actions OIDC (zero stored secrets). - Add composite action for JFrog + Go setup - Switch tests and lint jobs to databricks-protected-runner-group-large - Pre-cache project deps and build tools via jf go mod download/install - Keep fmt job on ubuntu-latest (only runs gofmt, no module downloads) NO_CHANGELOG=true ## Test plan - [x] Verify `make test` passes on Linux, Windows, macOS - [x] Verify `test-exp-aitools`, `test-exp-ssh`, `test-pipelines` are triggered and pass --------- Signed-off-by: Mihai Mitrea <mihai.mitrea@databricks.com>
1 parent e068441 commit 64b75cd

3 files changed

Lines changed: 70 additions & 6 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Setup build environment
2+
description: Set up Go toolchain and dependencies for CI
3+
4+
inputs:
5+
go-version:
6+
description: "Go version to install"
7+
required: true
8+
go-cache:
9+
description: "Enable Go module caching in setup-go"
10+
required: false
11+
default: "true"
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Setup JFrog CLI with OIDC
17+
uses: jfrog/setup-jfrog-cli@279b1f629f43dd5bc658d8361ac4802a7ef8d2d5 # v4.9.1
18+
env:
19+
JF_URL: https://databricks.jfrog.io
20+
with:
21+
oidc-provider-name: github-actions
22+
23+
- name: Setup Go
24+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
25+
with:
26+
go-version: ${{ inputs.go-version }}
27+
cache: ${{ inputs.go-cache }}
28+
29+
- name: Download Go modules via JFrog
30+
shell: bash
31+
run: |
32+
jf goc --repo-resolve=db-golang
33+
jf go mod download
34+
jf go install gotest.tools/gotestsum@c4a0df2e75a225d979a444342dd3db752b53619f # v1.13.0
35+
jf go install honnef.co/go/tools/cmd/staticcheck@b8ec13ce4d00445d75da053c47498e6f9ec5d7d6 # v0.6.1
36+
37+
# Point native go commands at the local module cache instead of
38+
# the network. go run pkg@version needs module lookups even when
39+
# cached; file:// satisfies these from disk without network access.
40+
echo "GOPROXY=file://$(go env GOMODCACHE)/cache/download" >> $GITHUB_ENV
41+
echo "GONOSUMCHECK=*" >> $GITHUB_ENV
42+
echo "GONOSUMDB=*" >> $GITHUB_ENV

.github/workflows/push.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ on:
1616

1717
jobs:
1818
tests:
19-
runs-on: ubuntu-latest
19+
runs-on:
20+
group: databricks-protected-runner-group
21+
labels: linux-ubuntu-latest
22+
23+
permissions:
24+
id-token: write
25+
contents: read
26+
2027
strategy:
2128
fail-fast: false
2229
matrix:
@@ -28,8 +35,8 @@ jobs:
2835
- name: Checkout
2936
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3037

31-
- name: Setup Go
32-
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
38+
- name: Setup build environment
39+
uses: ./.github/actions/setup-build-environment
3340
with:
3441
go-version: ${{ matrix.goVersion }}
3542

@@ -42,14 +49,20 @@ jobs:
4249
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4350

4451
lint:
45-
runs-on: ubuntu-latest
52+
runs-on:
53+
group: databricks-protected-runner-group
54+
labels: linux-ubuntu-latest
55+
56+
permissions:
57+
id-token: write
58+
contents: read
4659

4760
steps:
4861
- name: Checkout
4962
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5063

51-
- name: Setup Go
52-
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
64+
- name: Setup build environment
65+
uses: ./.github/actions/setup-build-environment
5366
with:
5467
go-version: "1.26"
5568

config/auth_azure_github_oidc_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,15 @@ func TestAzureGithubOIDCCredentials(t *testing.T) {
255255

256256
for _, tc := range testCases {
257257
t.Run(tc.desc, func(t *testing.T) {
258+
// Clear OIDC env vars that GitHub Actions injects when id-token: write
259+
// is set. Without this, Config picks them up via the env: struct tag
260+
// and tests that assert "not configured" fail.
261+
if tc.cfg.ActionsIDTokenRequestURL == "" {
262+
t.Setenv("ACTIONS_ID_TOKEN_REQUEST_URL", "")
263+
}
264+
if tc.cfg.ActionsIDTokenRequestToken == "" {
265+
t.Setenv("ACTIONS_ID_TOKEN_REQUEST_TOKEN", "")
266+
}
258267
tc.cfg.Credentials = &AzureGithubOIDCCredentials{} // only test this credential strategy
259268
tc.cfg.DebugHeaders = true
260269
if tc.wantHeaders == nil {

0 commit comments

Comments
 (0)