Skip to content
Permalink
Browse files
Update dockerfile, entrypoint.sh and Jenkinsfile to correctly run int…
…egration tests on Jenkins
  • Loading branch information
tbouron committed Dec 13, 2019
1 parent 10953ee commit 9e47642c7ac1d7e5063fcb7d1aab17fee5aa01f4
Showing 3 changed files with 53 additions and 23 deletions.
@@ -16,8 +16,7 @@
# under the License.
#

FROM maven:3.3-jdk-8
MAINTAINER Svetoslav Neykov "svetoslav.neykov@cloudsoft.io"
FROM maven:3.5.2-jdk-8

# For Alpine:
# FROM maven:3.3.9-jdk-8-alpine
@@ -27,12 +26,37 @@ MAINTAINER Svetoslav Neykov "svetoslav.neykov@cloudsoft.io"
# making it on par with the full debian image. Also some tests fail
# because of differences in the accepted arguments of the busybox provided tools.

# Install the non-headless JRE as some tests requires them
RUN apt-get update && apt-get install -y openjdk-8-jre

# Install necessary binaries to build brooklyn
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends net-tools ssh sudo wget chef && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
git-core \
procps \
golang-go \
rpm \
dpkg \
libpng-dev \
make \
automake \
autoconf \
libtool \
dpkg \
pkg-config \
nasm \
gcc \
net-tools \
ssh \
sudo \
wget \
chef && \
rm -rf /var/lib/apt/lists/*

# Prepare container for IT tests
RUN mkdir /etc/skel/.m2 && \
echo "<settings xmlns='http://maven.apache.org/SETTINGS/1.0.0'>" > /etc/skel/.m2/settings.xml && \
echo " <localRepository>/maven-repo</localRepository>" >> /etc/skel/.m2/settings.xml && \
echo " <localRepository>/var/maven</localRepository>" >> /etc/skel/.m2/settings.xml && \
echo "</settings>" >> /etc/skel/.m2/settings.xml && \
: The following are integration tests requirements && \
echo "127.0.0.1 localhost1 localhost2 localhost3 localhost4" >> /etc/hosts && \
@@ -49,8 +73,19 @@ RUN mkdir /etc/skel/.m2 && \
# We need them the same so that the mounted /build volume is accessible from inside the container.
COPY entrypoint.sh /usr/local/bin/entrypoint.sh

VOLUME /build
VOLUME /maven-repo
# Make sure the /.config && /.npm (for UI module builds) is writable for all users
RUN mkdir -p /.config && chmod -R 777 /.config
RUN mkdir -p /.npm && chmod -R 777 /.npm

# Make sure the /var/tmp (for RPM build) is writable for all users
RUN mkdir -p /var/tmp/ && chmod -R 777 /var/tmp/

# Make sure the /var/maven is writable for all users
RUN mkdir -p /var/maven/.m2/ && chmod -R 777 /var/maven/
ENV MAVEN_CONFIG=/var/maven/.m2

VOLUME /usr/build
VOLUME /var/maven

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["mvn -B clean install -PIntegration"]
CMD ["mvn -B clean test -PIntegration"]
@@ -38,12 +38,10 @@ node(label: 'ubuntu') {
}

stage('Run tests') {
environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} --mount type=bind,source="${HOME}/.m2/settings.xml",target=/var/maven/.m2/settings.xml,readonly -v ${WORKSPACE}:/usr/build -w /usr/build') {
sh 'mvn clean install -Duser.home=/var/maven -Duser.name=jenkins'
environmentDockerImage.inside('-i --name brooklyn-${DOCKER_TAG} -v ${WORKSPACE}/.m2:/var/maven/.m2 --mount type=bind,source="${HOME}/.m2/settings.xml",target=/var/maven/.m2/settings.xml,readonly -v ${WORKSPACE}:/usr/build -w /usr/build') {
sh 'mvn clean test -PIntegration -Duser.home=/var/maven -Duser.name=jenkins'
}
}

// We don't care to deploy artifact as each git submodule build do that already
}
}

@@ -60,16 +58,13 @@ node(label: 'ubuntu') {
])
}

// Conditional stage, when not building a PR
if (env.CHANGE_ID == null) {
stage('Send notifications') {
// Send email notifications
step([
$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: 'dev@brooklyn.apache.org',
sendToIndividuals: false
])
}
stage('Send notifications') {
// Send email notifications
step([
$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: 'dev@brooklyn.apache.org',
sendToIndividuals: false
])
}
}
@@ -41,7 +41,7 @@ else
ssh-keygen -t rsa -N "mypassphrase" -f ~/.ssh/id_rsa_with_passphrase
cat ~/.ssh/id_rsa_with_passphrase.pub >> ~/.ssh/authorized_keys

cd /build
cd /usr/build
echo "Available entropy in container: $(cat /proc/sys/kernel/random/entropy_avail)"
exec $@
fi

0 comments on commit 9e47642

Please sign in to comment.