Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
WIP: build with JDK11 and Docker on CircleCI
Browse files Browse the repository at this point in the history
* Upgrade docker-maven-plugin from 0.4.13 to 1.2.0
  * latest version supports Java 11
* Upgrade ssh-agent-tls from 0.0.3 to 0.0.4
* Upgrade ssh-agent-proxy from 0.1.5 to 0.2.0
  • Loading branch information
davidxia committed Oct 9, 2018
1 parent 931a1fd commit 2b03dbf
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 14 deletions.
25 changes: 25 additions & 0 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dockerfile for the container CircleCI uses to build and test helios
FROM ubuntu:bionic

RUN apt-get -qq update && apt-get -qq install \
# Required tools for primary containers that aren't already in bionic
# https://circleci.com/docs/2.0/custom-images/#required-tools-for-primary-containers
git ssh \
# tools we need
wget maven lsof jq python-minimal python-pip

# Download and validate checksum of openjdk-11
# Checksum from https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz.sha256
RUN wget --quiet https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz && \
echo '3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e openjdk-11_linux-x64_bin.tar.gz' > openjdk-11-sha256sum.txt && \
sha256sum -c openjdk-11-sha256sum.txt

# Install openjdk-11
RUN tar -xzf openjdk-11_linux-x64_bin.tar.gz && \
mkdir -p /usr/lib/jvm && \
mv jdk-11 /usr/lib/jvm/openjdk-11 && \
update-alternatives --install /usr/bin/java java /usr/lib/jvm/openjdk-11/bin/java 20000 && \
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/openjdk-11/bin/javac 20000

# Install codecov
RUN pip install codecov
60 changes: 59 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
CIRCLE_MACHINE_EXECUTOR: true
MAVEN_OPTS: -Xmx128m
JAVA_VERSION: *jdk_180_version

Expand All @@ -37,7 +38,7 @@ jobs:
if [[ $(python --version 2>&1) = *"2.7.10"* ]] || pyenv versions --bare | grep -x -q '2.7.10'; then pyenv global 2.7.10;else pyenv install --skip-existing 2.7.10 && pyenv global 2.7.10 && pyenv rehash && pip install virtualenv && pip install nose && pip install pep8 && pyenv rehash;fi
# Configuring Docker to accept remote connections
- run: ./circle.sh pre_machine
- run: ./circle.sh pre_machine && ./circle.sh pre_machine_docker

# Restarting docker for the changes to be applied
- run: sudo service docker restart
Expand All @@ -64,3 +65,60 @@ jobs:
path: /var/log/upstart/docker.log
- store_artifacts:
path: /tmp/circleci-test-results

build_java11:
docker:
- image: dxia/bionic-openjdk11:test
resource_class: large
working_directory: ~/spotify/helios
parallelism: 6
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
MAVEN_OPTS: -Xmx128m

steps:
# Machine Setup
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# The following `checkout` command checks out your code to your working directory. In 1.0 this is done implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
- checkout

- setup_remote_docker

# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS

- run: ./circle.sh pre_machine

- run:
command: ./circle.sh dependencies
no_output_timeout: 20m

- run:
command: ./circle.sh test
no_output_timeout: 20m

- run: if [ "$CIRCLE_NODE_INDEX" == "0" ]; then ./circle.sh post_test; fi

- run: ./circle.sh collect_test_reports

- store_test_results:
path: /tmp/circleci-test-results

# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: artifacts
- store_artifacts:
path: /var/log/upstart/docker.log
- store_artifacts:
path: /tmp/circleci-test-results

workflows:
version: 2
build_and_test:
jobs:
- build
- build_java11
22 changes: 14 additions & 8 deletions circle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

case "$1" in
pre_machine)
grep -c ^processor /proc/cpuinfo

# ensure correct level of parallelism
expected_nodes=6
if [ "$CIRCLE_NODE_TOTAL" -ne "$expected_nodes" ]
Expand All @@ -10,15 +12,17 @@ case "$1" in
exit 1
fi

# Edit pom files to have correct version syntax
for i in $(find . -name pom.xml -not -path './.rvm*'); do sed -i 's/${revision}/0/g' $i; done

;;

pre_machine_docker)
# have docker bind to localhost
docker_opts='DOCKER_OPTS="$DOCKER_OPTS -H tcp://0.0.0.0:2375"'
sudo sh -c "echo '$docker_opts' >> /etc/default/docker"

cat /etc/default/docker

# Edit pom files to have correct version syntax
for i in $(find . -name pom.xml -not -path './.rvm*'); do sed -i 's/${revision}/0/g' $i; done

;;

post_machine)
Expand All @@ -34,10 +38,12 @@ case "$1" in
;;

test)
# fix DOCKER_HOST to be accessible from within containers
docker0_ip=$(/sbin/ifconfig docker0 | grep 'inet addr' | \
awk -F: '{print $2}' | awk '{print $1}')
export DOCKER_HOST="tcp://$docker0_ip:2375"
if [ -n "$CIRCLE_MACHINE_EXECUTOR" ]; then
# fix DOCKER_HOST to be accessible from within containers
docker0_ip=$(/sbin/ifconfig docker0 | grep 'inet addr' | \
awk -F: '{print $2}' | awk '{print $1}')
export DOCKER_HOST="tcp://$docker0_ip:2375"
fi

case $CIRCLE_NODE_INDEX in
0)
Expand Down
4 changes: 2 additions & 2 deletions helios-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<version>1.2.0-SNAPSHOT</version>
<configuration>
<labels>
<label>com.spotify.helios.version="${project.version}"</label>
Expand Down Expand Up @@ -119,7 +119,7 @@
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<version>1.2.0-SNAPSHOT</version>
<configuration>
<labels>
<label>com.spotify.helios.version="${project.version}"</label>
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@
<dependency>
<groupId>com.spotify</groupId>
<artifactId>ssh-agent-tls</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
</dependency>
<dependency>
<groupId>com.spotify</groupId>
<artifactId>ssh-agent-proxy</artifactId>
<version>0.1.5</version>
<version>0.2.0</version>
</dependency>

<!--
Expand Down Expand Up @@ -435,7 +435,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<jacoco.version>0.7.1.201405082137</jacoco.version>
<jacoco.version>0.8.2</jacoco.version>
<jdeb.skip>false</jdeb.skip>
<surefire.version>2.16</surefire.version>
<surefireArgLine>-Xmx128m -XX:+TieredCompilation -XX:TieredStopAtLevel=1</surefireArgLine>
Expand Down

0 comments on commit 2b03dbf

Please sign in to comment.