Skip to content

Commit

Permalink
[INFRA-1534] Using a volume for maven settings file caused a lot of p…
Browse files Browse the repository at this point in the history
…roblems

When running in parallel in a pipeline you can not just mount several volumes
with the same name so you need to use docker.inside and move the settings file into the folder
But as m2-settings.xml was defined as volume it is created as a folder, hence
run-pct script failed to recognize the custom settings as it was looking for
a regular file
  • Loading branch information
raul-arabaolaza committed Apr 10, 2018
1 parent b126e3d commit 7ed3174
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 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.xml
VOLUME /pct/m2-settings
VOLUME /root/.m2
ENTRYPOINT ["run-pct"]
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -49,12 +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

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/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/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
7 changes: 7 additions & 0 deletions src/main/docker/run-pct.sh
Expand Up @@ -74,7 +74,14 @@ 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 7ed3174

Please sign in to comment.