You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2019/12/20 16:19:49 UTC

[brooklyn-dist] 01/10: Update dockerfile, entrypoint.sh and Jenkinsfile to correctly run integration tests on Jenkins

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-dist.git

commit 9e47642c7ac1d7e5063fcb7d1aab17fee5aa01f4
Author: Thomas Bouron <th...@cloudsoftcorp.com>
AuthorDate: Tue Dec 3 14:39:22 2019 +0000

    Update dockerfile, entrypoint.sh and Jenkinsfile to correctly run integration tests on Jenkins
---
 docker-itest/Dockerfile    | 49 +++++++++++++++++++++++++++++++++++++++-------
 docker-itest/Jenkinsfile   | 25 ++++++++++-------------
 docker-itest/entrypoint.sh |  2 +-
 3 files changed, 53 insertions(+), 23 deletions(-)

diff --git a/docker-itest/Dockerfile b/docker-itest/Dockerfile
index d50d7fa..f23afd1 100644
--- a/docker-itest/Dockerfile
+++ b/docker-itest/Dockerfile
@@ -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"]
diff --git a/docker-itest/Jenkinsfile b/docker-itest/Jenkinsfile
index 767864c..48fbbdc 100644
--- a/docker-itest/Jenkinsfile
+++ b/docker-itest/Jenkinsfile
@@ -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
+        ])
     }
 }
diff --git a/docker-itest/entrypoint.sh b/docker-itest/entrypoint.sh
index b3370a7..959befb 100755
--- a/docker-itest/entrypoint.sh
+++ b/docker-itest/entrypoint.sh
@@ -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