Skip to content

Commit

Permalink
[JENKINS-48711] - Fallback to the local build flow after the experime…
Browse files Browse the repository at this point in the history
…nts with in-DockerBuilds maven runs
  • Loading branch information
oleg-nenashev committed Dec 29, 2017
1 parent 1d20f1c commit d2be78c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Expand Up @@ -23,10 +23,13 @@
FROM maven:3.5.2-jdk-8
LABEL Description="Base image for running Jenkins Plugin Compat Tester (PCT) against custom plugins and Jenkins cores" Vendor="Jenkins project"

# Local build
COPY plugins-compat-tester-cli/target/ /pct/src/plugins-compat-tester-cli/target/
# Mode 1. Copy local artifact
# Local build (uncomment and remove the section below if needed)
COPY plugins-compat-tester-cli/target/plugins-compat-tester-cli-*.jar /pct/pct-cli.jar

#TODO: Uncomment once Jenkins Artifactory is recovered
# Mode 2. Build artifact from sources in Docker
# Use this flow if you do not want to build the binary on a local machine
# This mode is ineffective from the container size PoV and the layer number
# https://issues.jenkins-ci.org/browse/INFRA-1447
# Copy sources
#COPY plugins-compat-tester/ /pct/src/plugins-compat-tester/
Expand All @@ -37,8 +40,8 @@ COPY plugins-compat-tester-cli/target/ /pct/src/plugins-compat-tester-cli/targe
#COPY *.xml /pct/src/
#COPY LICENSE.txt /pct/src/LICENSE.txt

#WORKDIR /opt/pct/src/
#RUN ls -l && mvn clean package
#WORKDIR /pct/src/
#RUN mvn clean install -DskipTests && cp plugins-compat-tester-cli/target/plugins-compat-tester-cli-*.jar /pct/pct-cli.jar && mvn clean && mvn dependency:purge-local-repository

ENV JENKINS_WAR_PATH=/pct/jenkins.war
ENV PCT_OUTPUT_DIR=/pct/out
Expand Down
16 changes: 16 additions & 0 deletions Makefile
@@ -0,0 +1,16 @@
#Makefile

.PHONY: all
all: clean package docker

.PHONY: clean
clean:
mvn clean

.PHONY: package
package:
mvn package -DskipTests

.PHONY: docker
docker:
docker build -t jenkins/pct .
14 changes: 1 addition & 13 deletions src/main/docker/run-pct.sh
Expand Up @@ -82,20 +82,8 @@ if [ -z "${ARTIFACT_ID}" ] ; then
fi
mv "${TMP_CHECKOUT_DIR}" "${PCT_TMP}/localCheckoutDir/${ARTIFACT_ID}"

###
# Run PCT
###
cd /pct
PCT_CLI=$(ls src/plugins-compat-tester-cli/target/plugins-compat-tester-cli-*.jar )
if [ -e "${PCT_CLI}" ] ; then
echo "Using PCT CLI ${PCT_CLI}"
else
echo "Failed to locate PCT CLI"
exit -1
fi

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_CLI} -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" "$@"

0 comments on commit d2be78c

Please sign in to comment.