Skip to content

Commit

Permalink
[JENKINS-48711] - Make the settings file explicit && configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev committed Jan 3, 2018
1 parent 2890e4b commit 7283ea4
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Dockerfile
Expand Up @@ -48,12 +48,14 @@ ENV PCT_OUTPUT_DIR=/pct/out
ENV PCT_TMP=/pct/tmp

COPY src/main/docker/run-pct.sh /usr/local/bin/run-pct
COPY src/main/docker/pct-default-settings.xml /pct/default-m2-settings.xml

EXPOSE 5005

VOLUME /pct/plugin-src
VOLUME /pct/jenkins.war
VOLUME /pct/out
VOLUME /pct/tmp
VOLUME /pct/m2-settings.xml
VOLUME /root/.m2
ENTRYPOINT ["run-pct"]
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -54,6 +54,7 @@ Volumes:

* `/pct/plugin-src` - Plugin sources to be used for the PCT run. Sources will be checked out if not specified
* `/pct/jenkins.war` - Jenkins WAR file to be used for the PCT run
* `/pct/m2-settings.xml` - Custom Maven Settings file (optional)
* `/pct/out` - Output directory for PCT. All reports will be stored there
* `/pct/tmp` - Temporary directory. Can be exposed to analyze run failures
* `/root/.m2` - Maven repository. It can be used to pass settings.xml or to cache artifacts
Expand Down
34 changes: 34 additions & 0 deletions src/main/docker/pct-default-settings.xml
@@ -0,0 +1,34 @@
<settings>
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>

<profiles>
<!-- Give access to Jenkins plugins -->
<profile>
<id>jenkins</id>
<activation>
<activeByDefault>true</activeByDefault> <!-- change this to false, if you don't like to have it on per default -->
</activation>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<mirrors>
<mirror>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
<mirrorOf>m.g.o-public</mirrorOf>
</mirror>
</mirrors>
</settings>
9 changes: 8 additions & 1 deletion src/main/docker/run-pct.sh
Expand Up @@ -67,6 +67,13 @@ if [[ "$DEBUG" ]] ; then
)
fi

if [ -f "/pct/m2-settings.xml" ] ; then
echo "Using a custom Maven settings file specified by the volume"
MVN_SETTINGS_FILE="/pct/m2-settings.xml"
else
MVN_SETTINGS_FILE="/pct/default-m2-settings.xml"
fi

###
# Checkout sources
###
Expand Down Expand Up @@ -101,4 +108,4 @@ mkdir -p "${PCT_TMP}/work"
mkdir -p "${PCT_OUTPUT_DIR}"

# The image always uses external Maven due to https://issues.jenkins-ci.org/browse/JENKINS-48710
exec java ${JAVA_OPTS} ${extra_java_opts[@]} -jar /pct/pct-cli.jar -reportFile ${PCT_OUTPUT_DIR}/pct-report.xml -workDirectory "${PCT_TMP}/work" ${WAR_PATH_OPT} -skipTestCache true -localCheckoutDir "${PCT_TMP}/localCheckoutDir/${ARTIFACT_ID}" -includePlugins "${ARTIFACT_ID}" -mvn "/usr/bin/mvn" "$@"
exec java ${JAVA_OPTS} ${extra_java_opts[@]} -jar /pct/pct-cli.jar -reportFile ${PCT_OUTPUT_DIR}/pct-report.xml -workDirectory "${PCT_TMP}/work" ${WAR_PATH_OPT} -skipTestCache true -localCheckoutDir "${PCT_TMP}/localCheckoutDir/${ARTIFACT_ID}" -includePlugins "${ARTIFACT_ID}" -mvn "/usr/bin/mvn" -m2SettingsFile "${MVN_SETTINGS_FILE}" "$@"

0 comments on commit 7283ea4

Please sign in to comment.