Skip to content

Commit 99312ca

Browse files
Add Maven settings.xml with JFrog mirror configuration
Hardened runners terminate SSL handshakes to repo.maven.apache.org, so Maven needs an explicit mirror pointing to JFrog Artifactory. Generate ~/.m2/settings.xml with OIDC credentials from the JFrog setup step.
1 parent f48d57f commit 99312ca

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/actions/setup-build-environment/action.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Setup build environment
2-
description: Set up JDK with JFrog OIDC authentication for hardened runners
2+
description: Set up JDK with JFrog Artifactory as Maven mirror for hardened runners
33

44
inputs:
55
java-version:
@@ -11,6 +11,7 @@ runs:
1111
steps:
1212
- name: Setup JFrog CLI with OIDC
1313
if: runner.os != 'macOS'
14+
id: jfrog
1415
uses: jfrog/setup-jfrog-cli@279b1f629f43dd5bc658d8361ac4802a7ef8d2d5 # v4.9.1
1516
env:
1617
JF_URL: https://databricks.jfrog.io
@@ -21,3 +22,29 @@ runs:
2122
uses: actions/setup-java@b6e674f4b717d7b0ae3baee0fbe79f498905dfde # v1.4.4
2223
with:
2324
java-version: ${{ inputs.java-version }}
25+
26+
- name: Configure Maven for JFrog
27+
if: runner.os != 'macOS'
28+
shell: bash
29+
run: |
30+
mkdir -p ~/.m2
31+
cat > ~/.m2/settings.xml << EOF
32+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
33+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
35+
<mirrors>
36+
<mirror>
37+
<id>jfrog-maven</id>
38+
<url>https://databricks.jfrog.io/artifactory/db-maven/</url>
39+
<mirrorOf>*</mirrorOf>
40+
</mirror>
41+
</mirrors>
42+
<servers>
43+
<server>
44+
<id>jfrog-maven</id>
45+
<username>${{ steps.jfrog.outputs.oidc-user }}</username>
46+
<password><![CDATA[${{ steps.jfrog.outputs.oidc-token }}]]></password>
47+
</server>
48+
</servers>
49+
</settings>
50+
EOF

0 commit comments

Comments
 (0)