[ 
https://issues.apache.org/jira/browse/CASSANDRA-14563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16564431#comment-16564431
 ] 

Joseph Lynch commented on CASSANDRA-14563:
------------------------------------------

[~michaelsembwever] One thing I like about the docker approach is that we 
really know that Cassandra will really work with that JVM. We can build with 
whichever JVMs we want to support building on and we can run the unit tests 
using whichever JVMs we claim to support running on. Doing this kind of NxN 
build is reasonably straightforward with docker (and [~mkjellman] has got a 
great start of one laid down for the circleci integration).

To solve the local experience what if we had a local docker story? If we did 
some refactoring of the circleci commands into scripts we could reasonably 
easily have a local docker build that runs very closely the same environment 
that circleci runs. So a developer would just run docker build/run to build + 
run the tests. This would work for devs developing on Mac and Linux at least 
and I think Docker for windows is a thing I just haven't used it.

For example (obviously there needs to be more refactoring of the circleci into 
composable pieces but just as an example):
{noformat}
$ git diff HEAD                                                                 
                                                                                
                                                                             
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000..fb9eff4261
--- /dev/null
+++ b/dockerfiles/build/Dockerfile
@@ -0,0 +1,18 @@
+FROM kjellman/cassandra-test:0.4.3
+
+ENV JAVA_HOME /usr/local/openjdk8u154-cassandra-b02
+ENV ANT_HOME /usr/local/apache-ant-1.10.1
+ENV LANG en_US.UTF-8
+ENV JDK_HOME /usr/local/openjdk8u154-cassandra-b02
+ENV JAVA8_HOME /usr/local/openjdk8u154-cassandra-b02
+ENV JAVA7_HOME /usr/local/openjdk7u82-cassandra-b02
+ENV KEEP_TEST_DIR true
+ENV DEFAULT_DIR /home/cassandra/cassandra-dtest
+ENV PYTHONIOENCODING utf-8
+ENV PYTHONUNBUFFERED true
+ENV CASS_DRIVER_NO_EXTENSIONS true
+ENV CASS_DRIVER_NO_CYTHON true
+
+COPY --chown=cassandra . /home/cassandra/cassandra
+
+CMD ~/cassandra/run_build.sh
diff --git a/run_build.sh b/run_build.sh
new file mode 100755
index 0000000000..da4254264c
--- /dev/null
+++ b/run_build.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+export LANG=en_US.UTF-8
+export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
+export PATH=$PATH:$ANT_HOME/bin:$JAVA_HOME/bin
+cd ~/cassandra
+# Loop to prevent failure due to maven-ant-tasks not downloading a jar..
+for x in $(seq 1 3); do
+    ${ANT_HOME}/bin/ant clean jar
+    RETURN="$?"
+    if [ "${RETURN}" -eq "0" ]; then
+        break
+    fi
+done
+# Exit, if we didn't build successfully
+if [ "${RETURN}" -ne "0" ]; then
+    echo "Build failed with exit code: ${RETURN}"
+    exit ${RETURN}
+fi
{noformat}
Then to run the build locally:
{noformat}
sudo docker build dockerfiles/build -t cassandra-build
docker run cassandra-build
{noformat}
Related to this, it's pretty easy to setup circleci [per the cassandra 
docs|http://cassandra.apache.org/doc/latest/development/testing.html#circleci] 
and have a super fast iteration cycle as circleci runs the build and unit tests 
for free on every commit you push. It seems like if someone wants to make sure 
they're compatible with the build they should just run the circleci build?

> Add animalsniffer to build to ensure runtime jdk compatbility
> -------------------------------------------------------------
>
>                 Key: CASSANDRA-14563
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14563
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Build
>            Reporter: mck
>            Assignee: Sumanth Pasupuleti
>            Priority: Minor
>              Labels: lhf
>
> Cassandra-2.2 still supports running on JDK1.7
> No tests check this though, as all build and test with JDK1.8
> Adding the ant animalsniffer task can check that jdk1.8 classes or methods 
> are not used accidentally.
> ref: http://www.mojohaus.org/animal-sniffer/animal-sniffer/index.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to