Skip to content

Commit

Permalink
update to JDK 21 for integ tests (#737)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
  • Loading branch information
OVI3D0 authored Jan 29, 2025
1 parent ec150c0 commit af60c87
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
32 changes: 31 additions & 1 deletion .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ function setup {

# Init pyenv.
PATH=$HOME/.pyenv/shims:$PATH:$HOME/.pyenv/bin

# OpenSearch has different JDK requirements:
# - Gradle builds need JDK 21 (after Apache Lucene 10 upgrade)
# - OpenSearch runtime operations need JDK 17
# Store the current JAVA_HOME (Java 21) for Gradle
export GRADLE_JAVA_HOME=$JAVA_HOME

# Set JAVA_HOME to Java 17 for OpenSearch
if [ -n "$JAVA17_HOME" ]; then
echo "Setting JAVA_HOME to Java 17 for OpenSearch"
export JAVA_HOME=$JAVA17_HOME
java -version
else
echo "WARNING: JAVA17_HOME is not set!"
fi
}

function build_and_unit_test {
Expand All @@ -28,8 +43,23 @@ function run_it {

docker pull ubuntu/squid:latest

# make it38, it39, etc. so they run as concurrent GHA jobs
# Temporarily switch to Java 21 for Gradle builds if needed
if [ -n "$GRADLE_JAVA_HOME" ]; then
OLD_JAVA_HOME=$JAVA_HOME
export JAVA_HOME=$GRADLE_JAVA_HOME
echo "Switched to Java 21 for Gradle build"
java -version
fi

# Run the integration test
make "it${1//./}"

# Switch back to Java 17 if we changed it
if [ -n "$OLD_JAVA_HOME" ]; then
export JAVA_HOME=$OLD_JAVA_HOME
echo "Switched back to Java 17"
java -version
fi
}

$@
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/integ-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,31 @@ jobs:
- name: Install pyenv
run: git clone https://github.com/pyenv/pyenv.git ~/.pyenv

- name: Install JDK 21
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '21'
- run: |
echo "JAVA21_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "BUILD_JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Install JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- run: echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV
- run: |
echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV # Set JDK 17 as default
- name: Run the CI build script
run: bash .ci/build.sh run_it ${{ matrix.python-version }}
run: |
# For build operations that need JDK 21
if [ -n "$BUILD_JAVA_HOME" ]; then
export ORIG_JAVA_HOME=$JAVA_HOME
export JAVA_HOME=$BUILD_JAVA_HOME
# do build operations here
export JAVA_HOME=$ORIG_JAVA_HOME
fi
bash .ci/build.sh run_it ${{ matrix.python-version }}

0 comments on commit af60c87

Please sign in to comment.