Skip to content

Commit

Permalink
[INFRA-1534] Allow to set the location of custom maven settings witho…
Browse files Browse the repository at this point in the history
…ut using volumes
  • Loading branch information
raul-arabaolaza committed Apr 11, 2018
1 parent 7ed3174 commit d9c2b51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -52,6 +52,6 @@ VOLUME /pct/plugin-src
VOLUME /pct/jenkins.war
VOLUME /pct/out
VOLUME /pct/tmp
VOLUME /pct/m2-settings
VOLUME /pct/m2-settings.xml
VOLUME /root/.m2
ENTRYPOINT ["run-pct"]
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -49,13 +49,13 @@ The image will be able to determine this ID automatically if `CHECKOUT_SRC` or `
* `CHECKOUT_SRC` - Custom Git clone source (e.g. `https://github.com/oleg-nenashev/job-restrictions-plugin.git`). `https://github.com/jenkinsci/${ARTIFACT_ID}-plugin.git` by default
* `JAVA_OPTS` - Java options to be passed to the PCT CLI
* `DEBUG` - Boolean flag, which enables the Remote Debug mode (port == 5000)
* `M2_SETTINGS_FILE` - If set indicates the name of the custom maven settinmgs file to use (see volumes below), defaults to settings.xml
* `M2_SETTINGS_FILE` - If set indicates the path of the custom maven settinmgs file to use (see volumes below)

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 - Custom Maven Settings parent folder, if specified the PCT will use the maven settings file indicated by `M2_SETTINGS_FILE` environment variable
* `/pct/m2-settings.xml - Custom Maven Settings if `M2_SETTINGS_FILE` environment variable exists `run-pct` will ignore this location and use the one specified in the varaible`
* `/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
17 changes: 5 additions & 12 deletions src/main/docker/run-pct.sh
Expand Up @@ -17,9 +17,11 @@ if [ -n "${ARTIFACT_ID}" ]; then
echo "Running PCT for plugin ${ARTIFACT_ID}"
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"
CUSTOM_MAVEN_SETTINGS=${M2_SETTINGS_FILE:-"/pct/m2-settings.xml"}

if [ -f "${CUSTOM_MAVEN_SETTINGS}" ] ; then
echo "Using a custom Maven settings file"
MVN_SETTINGS_FILE="${CUSTOM_MAVEN_SETTINGS}"
else
MVN_SETTINGS_FILE="/pct/default-m2-settings.xml"
fi
Expand Down Expand Up @@ -74,15 +76,6 @@ if [[ "$DEBUG" ]] ; then
)
fi

CUSTOM_MAVEN_SETTINGS=${M2_SETTINGS_FILE:-settings.xml}

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

###
# Checkout sources
###
Expand Down

0 comments on commit d9c2b51

Please sign in to comment.