Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/actions/setup-jfrog/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup JFrog OIDC
description: Obtain a JFrog access token via GitHub OIDC and configure npm to use JFrog registry proxy

runs:
using: composite
steps:
- name: Get JFrog OIDC token
shell: bash
run: |
set -euo pipefail
ID_TOKEN=$(curl -sLS \
-H "User-Agent: actions/oidc-client" \
-H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=jfrog-github" | jq .value | tr -d '"')
echo "::add-mask::${ID_TOKEN}"
ACCESS_TOKEN=$(curl -sLS -XPOST -H "Content-Type: application/json" \
"https://databricks.jfrog.io/access/api/v1/oidc/token" \
-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 '"')
echo "::add-mask::${ACCESS_TOKEN}"
if [ -z "$ACCESS_TOKEN" ] || [ "$ACCESS_TOKEN" = "null" ]; then
echo "FAIL: Could not extract JFrog access token"
exit 1
fi
echo "JFROG_ACCESS_TOKEN=${ACCESS_TOKEN}" >> "$GITHUB_ENV"
echo "JFrog OIDC token obtained successfully"

- name: Configure npm for JFrog
shell: bash
run: |
set -euo pipefail
cat > ~/.npmrc << EOF
registry=https://databricks.jfrog.io/artifactory/api/npm/db-npm/
//databricks.jfrog.io/artifactory/api/npm/db-npm/:_authToken=${JFROG_ACCESS_TOKEN}
always-auth=true
EOF
echo "npm configured to use JFrog registry"
4 changes: 3 additions & 1 deletion .github/workflows/dco-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ permissions:

jobs:
check:
runs-on: ubuntu-latest
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ on:

permissions:
contents: read
id-token: write

jobs:
lint:
runs-on: ubuntu-latest
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
- uses: ./.github/actions/setup-jfrog
- name: Cache node modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
env:
Expand All @@ -34,7 +41,9 @@ jobs:
npm run lint

unit-test:
runs-on: ubuntu-latest
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
strategy:
matrix:
# only LTS versions starting from the lowest we support
Expand All @@ -53,6 +62,7 @@ jobs:
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4
with:
python-version: '3.10'
- uses: ./.github/actions/setup-jfrog
- name: Cache node modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
Expand All @@ -75,7 +85,9 @@ jobs:
retention-days: 1

e2e-test:
runs-on: ubuntu-latest
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
environment: azure-prod
env:
E2E_HOST: ${{ secrets.DATABRICKS_HOST }}
Expand All @@ -90,6 +102,10 @@ jobs:

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
- uses: ./.github/actions/setup-jfrog
- name: Cache node modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
Expand All @@ -113,7 +129,9 @@ jobs:

coverage:
needs: [unit-test, e2e-test]
runs-on: ubuntu-latest
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
env:
cache-name: cache-node-modules

Expand Down
Loading