I have a Google Cloud Build trigger which builds my Spring Boot app. Now I have to use jar from private Github Maven repository. So I need to provide 'settings.xml' to build process to access this package. My cloud build config:
steps:
- name: maven
args:
- clean
id: Clean
entrypoint: mvn
- name: maven
args:
- install
- '-Pdev'
id: Install
entrypoint: mvn
options:
substitutionOption: ALLOW_LOOSE
logging: CLOUD_LOGGING_ONLY
Example settings.xml file I should use to access my maven repository:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/OWNER/REPO</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>github</id>
<username>$_GITHUB_USERNAME</username>
<password>$_GITHUB_TOKEN</password>
</server>
</servers>
</settings>
So I need to access to settings.xml and update with credentials. Is there any elegant way to do this?