Skip to content

Commit

Permalink
feat(jenkins/agent): bake Maven settings into agent to route traffic …
Browse files Browse the repository at this point in the history
…to selfhosted mirror

Signed-off-by: hainenber <[email protected]>
  • Loading branch information
hainenber committed Nov 5, 2024
1 parent 584462c commit 6a51625
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions jenkins/jenkins-agent/cloud-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,55 @@ packages:
- openjdk-21-jre-headless
- openjdk-21-jdk-headless
- maven

# Pre-create Maven settings that links to mirrors in Jenkins agent home directory
write_files:
- path: /home/jenkins/.m2/settings.xml
content: |
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>central</id>
<mirrorOf>central</mirrorOf>
<url>http://192.168.72.1:8081/repository/maven-public/</url>
</mirror>
<mirror>
<!--This sends everything else to /public -->
<id>jenkins-public</id>
<mirrorOf>jenkins-public</mirrorOf>
<url>http://192.168.72.1:8081/repository/jenkins-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
<activeProfiles>
</settings>
owner: jenkins:users
permissions: '0644'
encoding: text/plain
defer: true

0 comments on commit 6a51625

Please sign in to comment.