@@ -20,20 +20,102 @@ permissions:
2020 contents : write
2121
2222jobs :
23+ # Gate: Vulnerability scan must pass before publishing.
24+ # Runs OWASP Dependency Check against NVD and fails on CVSS >= 7.
25+ vulnerability-scan :
26+ if : false
27+ runs-on :
28+ group : databricks-protected-runner-group
29+ labels : linux-ubuntu-latest
30+ steps :
31+ - name : Checkout
32+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
33+ with :
34+ ref : ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.event.workflow_run.head_sha }}
35+ fetch-tags : true
36+ fetch-depth : 0
37+
38+ - name : Set up JDK
39+ uses : actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
40+ with :
41+ java-version : 21
42+ distribution : ' adopt'
43+
44+ - name : Get JFrog OIDC token
45+ run : |
46+ set -euo pipefail
47+
48+ ID_TOKEN=$(curl -sLS \
49+ -H "User-Agent: actions/oidc-client" \
50+ -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
51+ "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=jfrog-github" | jq .value | tr -d '"')
52+ echo "::add-mask::${ID_TOKEN}"
53+
54+ ACCESS_TOKEN=$(curl -sLS -XPOST -H "Content-Type: application/json" \
55+ "https://databricks.jfrog.io/access/api/v1/oidc/token" \
56+ -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 '"')
57+ echo "::add-mask::${ACCESS_TOKEN}"
58+
59+ if [ -z "$ACCESS_TOKEN" ] || [ "$ACCESS_TOKEN" = "null" ]; then
60+ echo "FAIL: Could not extract JFrog access token"
61+ exit 1
62+ fi
63+
64+ echo "JFROG_ACCESS_TOKEN=${ACCESS_TOKEN}" >> "$GITHUB_ENV"
65+
66+ - name : Configure maven
67+ run : |
68+ set -euo pipefail
69+
70+ mkdir -p ~/.m2
71+ cat > ~/.m2/settings.xml << EOF
72+ <settings>
73+ <mirrors>
74+ <mirror>
75+ <id>jfrog-central</id>
76+ <mirrorOf>*</mirrorOf>
77+ <url>https://databricks.jfrog.io/artifactory/db-maven/</url>
78+ </mirror>
79+ </mirrors>
80+ <servers>
81+ <server>
82+ <id>jfrog-central</id>
83+ <username>gha-service-account</username>
84+ <password>${JFROG_ACCESS_TOKEN}</password>
85+ </server>
86+ </servers>
87+ </settings>
88+ EOF
89+
90+ - name : Run OWASP Dependency Check
91+ run : |
92+ mvn -pl jdbc-core org.owasp:dependency-check-maven:check \
93+ -Dnvd.api.key=${{ secrets.NVD_API_KEY }} \
94+ -DfailBuildOnCVSS=7
95+
96+ - name : Upload scan reports
97+ if : always()
98+ uses : actions/upload-artifact@ea165f8d65b6db9b8a1f7b0951caef032b8f2f72 # v4
99+ with :
100+ name : release-thin-vulnerability-scan
101+ path : |
102+ jdbc-core/target/dependency-check-report.html
103+ jdbc-core/target/dependency-check-report.json
104+
23105 publish-thin :
24106 # DISABLED: Third-party package publishing frozen per company-wide policy.
25107 # To re-enable, replace 'false' below with the original condition:
26108 # github.event_name == 'workflow_dispatch' ||
27109 # (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
28110 if : false
111+ needs : vulnerability-scan
29112 runs-on :
30113 group : databricks-protected-runner-group
31114 labels : linux-ubuntu-latest
32115 steps :
33116 - name : Checkout
34117 uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
35118 with :
36- # If manual trigger: use input tag, else use the SHA from the completed workflow run
37119 ref : ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.event.workflow_run.head_sha }}
38120 fetch-tags : true
39121 fetch-depth : 0
@@ -55,14 +137,12 @@ jobs:
55137 run : |
56138 set -euo pipefail
57139
58- # Get GitHub OIDC ID token
59140 ID_TOKEN=$(curl -sLS \
60141 -H "User-Agent: actions/oidc-client" \
61142 -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
62143 "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=jfrog-github" | jq .value | tr -d '"')
63144 echo "::add-mask::${ID_TOKEN}"
64145
65- # Exchange for JFrog access token
66146 ACCESS_TOKEN=$(curl -sLS -XPOST -H "Content-Type: application/json" \
67147 "https://databricks.jfrog.io/access/api/v1/oidc/token" \
68148 -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 '"')
@@ -103,23 +183,13 @@ jobs:
103183
104184 echo "Maven configured to use JFrog registry"
105185
106- # Step 1: Build and install dependencies to local Maven repository
107- # This builds jdbc-core (and parent) without publishing them.
108- # The -am flag builds all dependencies needed by assembly-thin.
109- # We use -Prelease here to generate sources/javadoc JARs for jdbc-core,
110- # which assembly-thin needs for its own sources/javadoc artifacts.
111- # GPG signing is skipped since we're only installing locally, not publishing.
112186 - name : Build dependencies
113187 run : |
114188 mvn -Prelease clean install --batch-mode -pl jdbc-core -am -Dgpg.skip=true \
115189 -Dnvd.api.key=${{ secrets.NVD_API_KEY }} \
116190 -Dossindex.username=${{ secrets.OSSINDEX_USERNAME }} \
117191 -Dossindex.password=${{ secrets.OSSINDEX_PASSWORD }}
118192
119- # Step 2: Deploy only the thin JAR module to Maven Central
120- # We don't use -am here to avoid the central-publishing-maven-plugin
121- # from collecting parent/jdbc-core artifacts into the deployment bundle.
122- # The jdbc-core dependency is already available from Step 1.
123193 - name : Publish thin JAR to Maven Central
124194 run : |
125195 mvn -Prelease deploy --batch-mode -pl assembly-thin \
@@ -135,10 +205,8 @@ jobs:
135205 id : get_tag
136206 run : |
137207 if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
138- # For manual trigger, use the input tag directly
139208 TAG="${{ inputs.tag }}"
140209 else
141- # For workflow_run, find the tag pointing to the current commit
142210 TAG=$(git tag --points-at HEAD | grep "^v" | head -1)
143211 if [ -z "$TAG" ]; then
144212 echo "Error: No tag found for current commit"
@@ -171,4 +239,4 @@ jobs:
171239 with :
172240 tag_name : ${{ steps.get_tag.outputs.tag }}
173241 files : |
174- assembly-thin/target/databricks-jdbc-thin-*.jar
242+ assembly-thin/target/databricks-jdbc-thin-*.jar
0 commit comments