[
https://issues.apache.org/jira/browse/AVRO-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14249839#comment-14249839
]
Niels Basjes commented on AVRO-1537:
------------------------------------
Hi [~tomwhite], I played around with the last version you uploaded. (Apparently
I wasn't looking at the last version when I wrote the previous comment).
What I changed here locally is that I removed the last 3 lines from your
Dockerfile (i.e. the git clone and svn checkout) and changed the build.sh like
below.
Now you can do a simple {code}./build.sh safetest{code} and validate the entire
build for all languages without any problems of needing to install anything
tricky.
If I want to run a single command manually from within that environment I can
simply do {code}./build.sh shell{code} and get a shell in the docker container.
Let me know what you think of this.
{code}
diff --git a/build.sh b/build.sh
index 06961c0..cff8dad 100755
--- a/build.sh
+++ b/build.sh
@@ -17,12 +17,16 @@
set -e # exit on error
-cd `dirname "$0"` # connect to root
+SOURCEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+cd ${SOURCEDIR} # connect to root
VERSION=`cat share/VERSION.txt`
+# The cryptic name is to avoid conflicts in case of a shared development
system (like jenkins)
+DOCKER_IMAGE_NAME="avro_build_image_$(md5sum ${SOURCEDIR}/docker/Dockerfile |
cut -d' ' -f1)"
+
function usage {
- echo "Usage: $0 {test|dist|sign|clean}"
+ echo "Usage: $0 {test|safetest|shell|dist|sign|clean}"
exit 1
}
@@ -31,6 +35,13 @@ then
usage
fi
+function runindocker {
+ docker build -t ${DOCKER_IMAGE_NAME} ${SOURCEDIR}/docker
+ # By mapping the .m2 directory you can do an mvn install from within the
container and use the result on your normal system.
+ # And this also is a significant speedup in subsequent builds because the
dependencies are downloaded only once.
+ docker run --rm=true -t -i -v ${SOURCEDIR}:/root/avro -w /root/avro -v
${HOME}/.m2:/root/.m2 ${DOCKER_IMAGE_NAME} $1 $2 $3 $4 $5 $6
+}
+
set -x # echo commands
for target in "$@"
@@ -72,7 +83,14 @@ case "$target" in
(cd lang/java; mvn package -DskipTests)
# run interop rpc test
/bin/bash share/test/interop/bin/test_rpc_interop.sh
+ ;;
+
+ safetest)
+ runindocker ./build.sh test
+ ;;
+ shell)
+ runindocker /bin/bash
;;
dist)
{code}
> Make it easier to set up a multi-language build environment
> -----------------------------------------------------------
>
> Key: AVRO-1537
> URL: https://issues.apache.org/jira/browse/AVRO-1537
> Project: Avro
> Issue Type: Improvement
> Reporter: Martin Kleppmann
> Attachments: AVRO-1537.patch, AVRO-1537.patch
>
>
> It's currently quite tedious to set up an environment in which the Avro test
> suites for all supported languages can be run, and in which release
> candidates can be built. This is especially so when we need to test against
> several different versions of a programming language or VM (e.g.
> JDK6/JDK7/JDK8, Ruby 1.8.7/1.9.3/2.0/2.1).
> Our shared Hudson server isn't an ideal solution, because it only runs tests
> on changes that are already committed, and maintenance of the server can't
> easily be shared across the community.
> I think a Docker image might be a good solution, since it could be set up by
> one person, shared with all Avro developers, and maintained by the community
> on an ongoing basis. But other VM solutions (Vagrant, for example?) might
> work just as well. Suggestions welcome.
> Related resources:
> * Using AWS (setting up an EC2 instance for Avro build and release):
> https://cwiki.apache.org/confluence/display/AVRO/How+To+Release#HowToRelease-UsingAWSforAvroBuildandRelease
> * Testing multiple versions of Ruby in CI: AVRO-1515
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)