Merge pull request #152 from nakomis/update-notices

Updates NOTICE files
diff --git a/Dockerfile b/Dockerfile
index 14f78f4..ca7afef 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,3 +19,10 @@
 
 # Install necessary binaries to build brooklyn-dist
 RUN apk add --no-cache git rpm dpkg
+
+# 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
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..fc02069
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+node(label: 'ubuntu') {
+    if (env.CHANGE_ID) {
+        properties([
+            pipelineTriggers([
+                issueCommentTrigger('.*test this please.*')
+            ])
+        ])
+    }
+
+    catchError {
+        def environmentDockerImage
+
+        def dockerTag = env.BUILD_TAG.replace('%2F', '-')
+
+        withEnv(["DOCKER_TAG=${dockerTag}"]) {
+            stage('Clone repository') {
+                checkout scm
+            }
+
+            stage('Prepare environment') {
+                echo 'Creating maven cache ...'
+                sh 'mkdir -p ${WORKSPACE}/.m2'
+                echo 'Building docker image for test environment ...'
+                environmentDockerImage = docker.build('brooklyn:${DOCKER_TAG}')
+            }
+
+            stage('Run tests') {
+                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 install -Prpm -Pdeb -Duser.home=/var/maven -Duser.name=jenkins'
+                }
+            }
+        }
+    }
+
+    // ---- Post actions steps, to always perform ----
+
+    stage('Publish test results') {
+        // Publish JUnit results
+        junit allowEmptyResults: true, testResults: '**/target/surefire-reports/junitreports/*.xml'
+
+        // Publish TestNG results
+        step([
+            $class: 'Publisher',
+            reportFilenamePattern: '**/testng-results.xml'
+        ])
+    }
+
+    // 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
+            ])
+        }
+    }
+}
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 @@
 # 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 @@
 # 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
new file mode 100644
index 0000000..48fbbdc
--- /dev/null
+++ b/docker-itest/Jenkinsfile
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+node(label: 'ubuntu') {
+    catchError {
+        def environmentDockerImage
+
+        def dockerTag = env.BUILD_TAG.replace('%2F', '-')
+
+        withEnv(["DOCKER_TAG=${dockerTag}"]) {
+            stage('Clone repository') {
+                checkout scm
+            }
+
+            stage('Prepare environment') {
+                echo 'Creating maven cache ...'
+                sh 'mkdir -p ${WORKSPACE}/.m2'
+                sh 'git submodule init'
+                sh 'git submodule update --remote --merge --recursive'
+                echo 'Building docker image for test environment ...'
+                environmentDockerImage = docker.build('brooklyn:${DOCKER_TAG}')
+            }
+
+            stage('Run tests') {
+                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'
+                }
+            }
+        }
+    }
+
+    // ---- Post actions steps, to always perform ----
+
+    stage('Publish test results') {
+        // Publish JUnit results
+        junit allowEmptyResults: true, testResults: '**/target/surefire-reports/junitreports/*.xml'
+
+        // Publish TestNG results
+        step([
+            $class: 'Publisher',
+            reportFilenamePattern: '**/testng-results.xml'
+        ])
+    }
+
+    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 @@
   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
diff --git a/release/environment.sh b/release/environment.sh
index 47f3280..1ddf73a 100755
--- a/release/environment.sh
+++ b/release/environment.sh
@@ -102,10 +102,10 @@
 confirm || exit
 
 cat <<EOF
-OLD_MASTER_VERSION=${current_version}
-NEW_MASTER_VERSION=${continue_version}
-VERSION_NAME=${release_version}
-RC_NUMBER=${rc_suffix}
-SUBMODULES="$( perl -n -e 'if ($_ =~ /path += +(.*)$/) { print $1." " }' < .gitmodules )"
-MODULES=". \${SUBMODULES}"
+export OLD_MASTER_VERSION=${current_version}
+export NEW_MASTER_VERSION=${continue_version}
+export VERSION_NAME=${release_version}
+export RC_NUMBER=${rc_suffix}
+export SUBMODULES="$( perl -n -e 'if ($_ =~ /path += +(.*)$/) { print $1." " }' < .gitmodules )"
+export MODULES=". \${SUBMODULES}"
 EOF
diff --git a/release/make-release-artifacts.sh b/release/make-release-artifacts.sh
index 9f804ee..f12151c 100755
--- a/release/make-release-artifacts.sh
+++ b/release/make-release-artifacts.sh
@@ -175,9 +175,7 @@
 # * sandbox (which hasn't been vetted so thoroughly)
 # * release (where this is running, and people who *have* the release don't need to make it)
 # * jars and friends (these are sometimes included for tests, but those are marked as skippable,
-# * cli/vendor - that's not source controlled and not removed by mvn clean so ignore it in case it's already there
-#     and apache convention does not allow them in source builds; see PR #365
-rsync -rtp --exclude .git\* --exclude brooklyn-docs/ --exclude brooklyn-library/sandbox/ --exclude brooklyn-client/cli/vendor/ --exclude brooklyn-dist/release/ --exclude '**/*.[ejw]ar' . ${staging_dir}/${release_name}-src
+rsync -rtp --exclude .git\* --exclude brooklyn-docs/ --exclude brooklyn-library/sandbox/ --exclude brooklyn-dist/release/ --exclude '**/*.[ejw]ar' . ${staging_dir}/${release_name}-src
 
 rm -rf ${artifact_dir}
 mkdir -p ${artifact_dir}
@@ -200,9 +198,9 @@
 
 # Perform the build
 if [ -z "${dry_run}" ]; then
-    ( cd ${src_staging_dir} && mvn deploy -Papache-release )
+    ( cd ${src_staging_dir} && mvn deploy -Dclient -Drpm -Ddeb -Papache-release )
 else
-    ( cd ${src_staging_dir} && mvn install -Papache-release )
+    ( cd ${src_staging_dir} && mvn install -Dclient -Drpm -Ddeb -Papache-release )
 fi
 
 # Re-pack the archive with the correct names
@@ -270,14 +268,12 @@
 ###############################################################################
 # Signatures and checksums
 
-# OSX doesn't have sha256sum, even if MacPorts md5sha1sum package is installed.
+# OSX doesn't have sha256sum, even if MacPorts package is installed.
 # Easy to fake it though.
 which sha256sum >/dev/null || alias sha256sum='shasum -a 256' && shopt -s expand_aliases
 
 ( cd ${artifact_dir} &&
     for a in *.tar.gz *.zip *.rpm *.deb; do
-        md5sum -b ${a} > ${a}.md5
-        sha1sum -b ${a} > ${a}.sha1
         sha256sum -b ${a} > ${a}.sha256
         gpg2 --armor --output ${a}.asc --detach-sig ${a}
     done
diff --git a/release/verify_brooklyn_rc.sh b/release/verify_brooklyn_rc.sh
index 198a1d7..2e3c0eb 100755
--- a/release/verify_brooklyn_rc.sh
+++ b/release/verify_brooklyn_rc.sh
@@ -25,7 +25,6 @@
 fi
 
 command -v svn >/dev/null 2>&1 || { echo >&2 "[x] svn required but is not installed. Aborting."; exit 1; }
-command -v md5sum >/dev/null 2>&1 || { echo >&2 "[x] md5sum required but is not installed. On macOS install with 'brew install md5sum'. Aborting."; exit 1; }
 command -v shasum >/dev/null 2>&1 || { echo >&2 "[x] shasum required but is not installed. On macOS install with 'brew install shasum'. Aborting."; exit 1; }
 command -v gpg >/dev/null 2>&1 || { echo >&2 "[x] gpg required but is not installed. On macOS install with 'brew install gpg'. Aborting."; exit 1; }
 command -v rpm >/dev/null 2>&1 || { echo >&2 "[x] rpm required but is not installed. On macOS install with 'brew install rpm'. Aborting."; exit 1; }
@@ -80,13 +79,11 @@
 echo "==============================================================================="
 echo
 
-for ARTIFACT in $(find * -type f ! \( -name '*.asc' -o -name '*.md5' -o -name '*.sha1' -o -name '*.sha256' \) ); do
-  md5sum -c ${ARTIFACT}.md5 && \
-  shasum -a1 -c ${ARTIFACT}.sha1 && \
+find * -type f ! \( -name '*.asc' -o -name '*.sha256' \) -print | while read -r ARTIFACT ; do
   shasum -a256 -c ${ARTIFACT}.sha256 && \
   gpg --verify ${ARTIFACT}.asc ${ARTIFACT} && \
-  echo "[✓] Signatures verified for $ARTIFACT" \
-    || { echo "[x] Invalid signature for $ARTIFACT. Aborting."; exit 1; }
+  echo "[✓] Signatures verified for ${ARTIFACT}" \
+    || { echo "[x] Invalid signature for ${ARTIFACT}. Aborting."; exit 1; }
 done
 
 echo
@@ -96,7 +93,7 @@
 echo
 
 GA_RELEASE=${RELEASE%%-rc?}
-for ARCHIVE in $(ls *.{tar.gz,zip,rpm}); do
+find * -type f \( -name '*.tar.gz' -or -name '*.zip' -or -name '*.rpm' \) -print | while read -r ARCHIVE ; do
   REL_ARCHIVE=${ARCHIVE/-rc?}
   case $ARCHIVE in
     *.tar.gz)