Skip to content

Commit 811d52d

Browse files
authored
Fix failing CI due to invalid JDK version (#11)
The default JDK version in Travis had become JDK 11, which is a problem for Spark. This fixes that using a fix from https://github.com/dpkp/kafka-python
1 parent 8271082 commit 811d52d

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: python
2+
dist: xenial
23
python:
34
- "3.6"
45
jobs:
@@ -17,7 +18,9 @@ jobs:
1718
- echo "prd" > dags/environment.conf
1819
- coverage run -m pytest integrity_tests/*
1920
- stage: mock_pipeline_tests
21+
before_install:
22+
- source travis_java_install.sh
2023
install:
2124
- pip install -r mock_pipeline_tests/requirements.txt
2225
script:
23-
- coverage run -m pytest mock_pipeline_tests/*
26+
- coverage run -m pytest mock_pipeline_tests/*

travis_java_install.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# borrowed from: https://github.com/dpkp/kafka-python/blob/master/travis_java_install.sh
4+
5+
# Kafka requires Java 8 in order to work properly. However, TravisCI's Ubuntu
6+
# 16.04 ships with Java 11 and Java can't be set with `jdk` when python is
7+
# selected as language. Ubuntu 14.04 does not work due to missing python 3.7
8+
# support on TravisCI which does have Java 8 as default.
9+
10+
# show current JAVA_HOME and java version
11+
echo "Current JAVA_HOME: $JAVA_HOME"
12+
echo "Current java -version:"
13+
which java
14+
java -version
15+
16+
echo "Updating JAVA_HOME"
17+
# change JAVA_HOME to Java 8
18+
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
19+
20+
echo "Updating PATH"
21+
export PATH=${PATH/\/usr\/local\/lib\/jvm\/openjdk11\/bin/$JAVA_HOME\/bin}
22+
23+
echo "New java -version"
24+
which java
25+
java -version

0 commit comments

Comments
 (0)