You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2017/03/02 12:29:14 UTC
[1/2] brooklyn-dist git commit: A Docker container to run integration
tests in
Repository: brooklyn-dist
Updated Branches:
refs/heads/master f6eeb7029 -> 56994e2aa
A Docker container to run integration tests in
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/a8c74bb1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/a8c74bb1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/a8c74bb1
Branch: refs/heads/master
Commit: a8c74bb1eca02f38b87a803a062b97c732292d66
Parents: 05db9ba
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Mon Jan 9 17:04:09 2017 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Mon Jan 9 17:28:52 2017 +0200
----------------------------------------------------------------------
docker-itest/Dockerfile | 56 +++++++++++++++++++++++++++++++++++++++++
docker-itest/entrypoint.sh | 47 ++++++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/a8c74bb1/docker-itest/Dockerfile
----------------------------------------------------------------------
diff --git a/docker-itest/Dockerfile b/docker-itest/Dockerfile
new file mode 100644
index 0000000..b8bfbe9
--- /dev/null
+++ b/docker-itest/Dockerfile
@@ -0,0 +1,56 @@
+# 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.
+#
+
+FROM maven:3.3.9-jdk-7
+MAINTAINER Svetoslav Neykov "svetoslav.neykov@cloudsoft.io"
+
+# For Alpine:
+# FROM maven:3.3.9-jdk-8-alpine
+# RUN apk add --update --no-cache bash netcat-openbsd sudo wget openssh
+# RUN ssh-keygen -A
+# This is missing knife - adding it would grow the image size considerably
+# 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.
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends net-tools ssh sudo wget && \
+ rm -rf /var/lib/apt/lists/*
+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 "</settings>" >> /etc/skel/.m2/settings.xml && \
+ : The following are integration tests requirements && \
+ echo "127.0.0.1 localhost1 localhost2 localhost3 localhost4" >> /etc/hosts && \
+ mkdir /etc/skel/.brooklyn && \
+ cd /etc/skel/.brooklyn && \
+ wget -q http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz && \
+ gunzip GeoLite2-City.mmdb.gz && \
+ echo "brooklyn.location.named.localhost-passphrase=localhost" >> brooklyn.properties && \
+ echo "brooklyn.location.named.localhost-passphrase.privateKeyFile=~/.ssh/id_rsa_with_passphrase" >> brooklyn.properties && \
+ echo "brooklyn.location.named.localhost-passphrase.privateKeyPassphrase=mypassphrase" >> brooklyn.properties && \
+ chmod 600 brooklyn.properties
+
+# Add the brooklyn user at runtime so that we can set its USER_ID same as the user that's calling "docker run"
+# 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
+
+ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
+CMD ["mvn -B clean install -PIntegration"]
http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/a8c74bb1/docker-itest/entrypoint.sh
----------------------------------------------------------------------
diff --git a/docker-itest/entrypoint.sh b/docker-itest/entrypoint.sh
new file mode 100755
index 0000000..b3370a7
--- /dev/null
+++ b/docker-itest/entrypoint.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+#
+# 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.
+#
+
+set -e
+if [ "$(id -u)" = "0" ]; then
+ echo "Setting up system"
+ echo "brooklyn ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/brooklyn
+ chmod 0440 /etc/sudoers.d/brooklyn
+ GROUP_ID=${DOCKER_GROUP_ID:-1000}
+ USER_ID=${DOCKER_USER_ID:-1000}
+ #(alpine): addgroup -g $GROUP_ID brooklyn
+ #(alpine): adduser -g "brooklyn" -s /bin/bash -G brooklyn -u $USER_ID -D brooklyn
+ groupadd -g $GROUP_ID brooklyn
+ echo "Creating user"
+ useradd --shell /bin/bash -u $USER_ID -o -c "" -m -k /etc/skel -g brooklyn brooklyn
+ chown brooklyn:brooklyn /home/brooklyn
+ sudo service ssh start
+ exec sudo -H -u brooklyn -i /usr/local/bin/entrypoint.sh $@
+else
+ echo "Setting up Brooklyn"
+ # Integration tests requirements
+ ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
+ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
+ ssh-keygen -t rsa -N "mypassphrase" -f ~/.ssh/id_rsa_with_passphrase
+ cat ~/.ssh/id_rsa_with_passphrase.pub >> ~/.ssh/authorized_keys
+
+ cd /build
+ echo "Available entropy in container: $(cat /proc/sys/kernel/random/entropy_avail)"
+ exec $@
+fi
[2/2] brooklyn-dist git commit: Closes #77
Posted by sv...@apache.org.
Closes #77
A Docker container to run integration tests in
Run with:
```
docker run --rm -v $(pwd):/build \
-v ~/.m2/repository/:/maven-repo \
-e DOCKER_USER_ID=$(id -u) -e DOCKER_GROUP_ID=$(id -g) \ --> use this line only on linux machines
brooklyn-itest \
mvn -B clean install -PIntegration -Dmaven.test.failure.ignore=true --fail-never
```
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/56994e2a
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/56994e2a
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/56994e2a
Branch: refs/heads/master
Commit: 56994e2aae75197a411082404cd09ce192269c6b
Parents: f6eeb70 a8c74bb
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Thu Mar 2 14:29:06 2017 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Thu Mar 2 14:29:06 2017 +0200
----------------------------------------------------------------------
docker-itest/Dockerfile | 56 +++++++++++++++++++++++++++++++++++++++++
docker-itest/entrypoint.sh | 47 ++++++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+)
----------------------------------------------------------------------