Skip to content

Commit 53c70bc

Browse files
committed
Add old JDK to the Docker images to support running Clouseau
This change makes it possible to run tests that require the Search functionality to be configured. Therefore the test coverage could be increased and issues could be caught with the related applications, such as Dreyfus and the `text` searches in Mango. Note that because Clouseau requires a relatively old version of JDK, it could be run on x86-64 and arm64 systems only.
1 parent 0065863 commit 53c70bc

File tree

11 files changed

+170
-19
lines changed

11 files changed

+170
-19
lines changed

bin/install-clouseau-jdk.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
# stop on error
21+
set -e
22+
23+
# Check if running as root
24+
if [[ ${EUID} -ne 0 ]]; then
25+
echo "Sorry, this script must be run as root."
26+
echo "Try: sudo $0 $*"
27+
exit 1
28+
fi
29+
30+
ZULU_VSN="$CLOUSEAUJDKVERSION"
31+
32+
if [[ -z "$ZULU_VSN" ]]; then
33+
echo "No Zulu JDK version is set."
34+
echo "Try setting the CLOUSEAUJDKVERSION environment variable."
35+
exit 1
36+
fi
37+
38+
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
39+
40+
. ${SCRIPTPATH}/detect-arch.sh
41+
. ${SCRIPTPATH}/detect-os.sh
42+
43+
case "${OSTYPE}/${ARCH}" in
44+
linux*/x86_64) ZULU_PLATFORM="linux_x64" ;;
45+
linux*/aarch64) ZULU_PLATFORM="linux_aarch64" ;;
46+
*)
47+
echo "Unsupported platform for the Zulu JDK: ${OSTYPE}/${ARCH}."
48+
exit 1
49+
;;
50+
esac
51+
52+
ZULU_DIST=https://cdn.azul.com/zulu/bin/"${ZULU_VSN}"-"${ZULU_PLATFORM}".tar.gz
53+
54+
function ensure_tool() {
55+
_tool="$1"
56+
57+
if ! type "${_tool}" > /dev/null 2>&1; then
58+
echo "Please install `${_tool}`"
59+
exit 1
60+
fi
61+
}
62+
63+
ensure_tool tar
64+
ensure_tool curl
65+
66+
echo "==> Installing Zulu JDK from $ZULU_DIST"
67+
68+
mkdir -p /opt/java/clouseaujdk/
69+
70+
if ! curl -sSL --max-redirs 1 -o - "$ZULU_DIST" \
71+
| (tar -xzf - --strip-component 1 -C /opt/java/clouseaujdk/ 2> /dev/null); then
72+
echo "===> Could not install the Zulu JDK distribution"
73+
exit 1
74+
fi
75+
76+
echo "===> DONE"

bin/install-dependencies.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
# stop on error
2929
set -e
3030

31-
# Defaults updated 2023-03-20
31+
# Defaults updated 2023-11-09
3232
NODEVERSION=${NODEVERSION:-14}
3333
ERLANGVERSION=${ERLANGVERSION:-24.3.4.14}
3434
ELIXIRVERSION=${ELIXIRVERSION:-v1.14.5}
35+
CLOUSEAUJDKVERSION=${CLOUSEAUJDKVERSION:-zulu8.74.0.17-ca-jdk8.0.392}
3536

3637

3738
# This works if we're not called through a symlink
@@ -52,6 +53,10 @@ if [[ $2 == "noerlang" ]]; then
5253
SKIPERLANG=1
5354
fi
5455

56+
if [[ $3 == "noclouseaujdk" ]]; then
57+
SKIPCLOUSEAUJDK=1
58+
fi
59+
5560
# Check if running as root
5661
if [[ ${EUID} -ne 0 ]]; then
5762
echo "Sorry, this script must be run as root."
@@ -94,6 +99,9 @@ case "${OSTYPE}" in
9499
ERLANGVERSION=${ERLANGVERSION} ${SCRIPTPATH}/yum-erlang.sh
95100
ELIXIRVERSION=${ELIXIRVERSION} ${SCRIPTPATH}/install-elixir.sh
96101
fi
102+
if [[ ! ${SKIPCLOUSEAUJDK} ]]; then
103+
CLOUSEAUJDKVERSION=${CLOUSEAUJDKVERSION} ${SCRIPTPATH}/install-clouseau-jdk.sh
104+
fi
97105
run_scripts ${EXTRA_SCRIPTS_DIR} 'yum-'
98106
elif [[ ${ID} =~ ${debians} ]]; then
99107

@@ -103,6 +111,9 @@ case "${OSTYPE}" in
103111
ERLANGVERSION=${ERLANGVERSION} ${SCRIPTPATH}/apt-erlang.sh
104112
ELIXIRVERSION=${ELIXIRVERSION} ${SCRIPTPATH}/install-elixir.sh
105113
fi
114+
if [[ ! ${SKIPCLOUSEAUJDK} ]]; then
115+
CLOUSEAUJDKVERSION=${CLOUSEAUJDKVERSION} ${SCRIPTPATH}/install-clouseau-jdk.sh
116+
fi
106117
run_scripts ${EXTRA_SCRIPTS_DIR} 'apt-'
107118
else
108119
echo "Sorry, we don't support this Linux (${ID}) yet."

dockerfiles/almalinux-8

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31-
# Select version of Node, Erlang and Elixir to install
31+
# Choose whether to install JDK for Clouseau, default yes
32+
ARG clouseaujdk=clouseaujdk
33+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -53,7 +56,12 @@ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
5356
RUN ERLANGVERSION=$erlangversion \
5457
ELIXIRVERSION=$elixirversion \
5558
NODEVERSION=$nodeversion \
56-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
59+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
60+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
61+
62+
# This are needed for the Clouseau integration
63+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
64+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5765

5866
# Allow Jenkins to sudo
5967
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/almalinux-9

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31-
# Select version of Node, Erlang and Elixir to install
31+
# Choose whether to install JDK for Clouseau, default yes
32+
ARG clouseaujdk=clouseaujdk
33+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
3841
useradd --uid 910 --gid jenkins --create-home jenkins
3942

43+
4044
# Copy couchdb-ci repo into root's home directory
4145
ADD --chown=root:root bin /root/couchdb-ci/bin/
4246
ADD --chown=root:root files /root/couchdb-ci/files/
@@ -53,7 +57,12 @@ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
5357
RUN ERLANGVERSION=$erlangversion \
5458
ELIXIRVERSION=$elixirversion \
5559
NODEVERSION=$nodeversion \
56-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
60+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
61+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
62+
63+
# This are needed for the Clouseau integration
64+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
65+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5766

5867
# Allow Jenkins to sudo
5968
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/centos-7

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31-
# Select version of Node, Erlang and Elixir to install
31+
# Choose whether to install JDK for Clouseau, default yes
32+
ARG clouseaujdk=clouseaujdk
33+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -53,7 +56,12 @@ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
5356
RUN ERLANGVERSION=$erlangversion \
5457
ELIXIRVERSION=$elixirversion \
5558
NODEVERSION=$nodeversion \
56-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
59+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
60+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
61+
62+
# This are needed for the Clouseau integration
63+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
64+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5765

5866
# Allow Jenkins to sudo
5967
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/debian-bullseye

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
3030
ARG js=js
3131
# Choose whether to install Erlang, default yes
3232
ARG erlang=erlang
33-
# Select version of Node, Erlang and Elixir
33+
# Choose whether to install JDK for Clouseau, default yes
34+
ARG clouseaujdk=clouseaujdk
35+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3436
ARG erlangversion=24.3.4.14
3537
ARG elixirversion=v1.14.5
3638
ARG nodeversion=14
39+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3740

3841
# Create Jenkins user and group
3942
RUN groupadd --gid 910 jenkins; \
@@ -52,7 +55,12 @@ RUN mkdir -p /usr/src/couchdb; \
5255
RUN ERLANGVERSION=$erlangversion \
5356
ELIXIRVERSION=$elixirversion \
5457
NODEVERSION=$nodeversion \
55-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
58+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
59+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
60+
61+
# This are needed for the Clouseau integration
62+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
63+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5664

5765
# Allow Jenkins to sudo
5866
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/debian-buster

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
3030
ARG js=js
3131
# Choose whether to install Erlang, default yes
3232
ARG erlang=erlang
33-
# Select version of Node, Erlang and Elixir
33+
# Choose whether to install JDK for Clouseau, default yes
34+
ARG clouseaujdk=clouseaujdk
35+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3436
ARG erlangversion=24.3.4.14
3537
ARG elixirversion=v1.14.5
3638
ARG nodeversion=14
39+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3740

3841
# Create Jenkins user and group
3942
RUN groupadd --gid 910 jenkins; \
@@ -52,7 +55,12 @@ RUN mkdir -p /usr/src/couchdb; \
5255
RUN ERLANGVERSION=$erlangversion \
5356
ELIXIRVERSION=$elixirversion \
5457
NODEVERSION=$nodeversion \
55-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
58+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
59+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
60+
61+
# This are needed for the Clouseau integration
62+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
63+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5664

5765
# Allow Jenkins to sudo
5866
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/ubuntu-bionic

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31-
# Select version of Node, Erlang and Elixir to install
31+
# Choose whether to install JDK for Clouseau, default yes
32+
ARG clouseaujdk=clouseaujdk
33+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -50,7 +53,12 @@ RUN mkdir -p /usr/src/couchdb; \
5053
RUN ERLANGVERSION=$erlangversion \
5154
ELIXIRVERSION=$elixirversion \
5255
NODEVERSION=$nodeversion \
53-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
56+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
57+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
58+
59+
# This are needed for the Clouseau integration
60+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
61+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5462

5563
# Allow Jenkins to sudo
5664
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/ubuntu-focal

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31-
# Select version of Node, Erlang and Elixir to install
31+
# Choose whether to install JDK for Clouseau, default yes
32+
ARG clouseaujdk=clouseaujdk
33+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -50,7 +53,12 @@ RUN mkdir -p /usr/src/couchdb; \
5053
RUN ERLANGVERSION=$erlangversion \
5154
ELIXIRVERSION=$elixirversion \
5255
NODEVERSION=$nodeversion \
53-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
56+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
57+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
58+
59+
# This are needed for the Clouseau integration
60+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
61+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5462

5563
# Allow Jenkins to sudo
5664
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/ubuntu-jammy

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31-
# Select version of Node, Erlang and Elixir to install
31+
# Choose whether to install JDK for Clouseau, default yes
32+
ARG clouseaujdk=clouseaujdk
33+
# Select version of Node, Erlang, Elixir, and Clouseau JDK to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseaujdkversion=zulu8.74.0.17-ca-jdk8.0.392
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -50,7 +53,12 @@ RUN mkdir -p /usr/src/couchdb; \
5053
RUN ERLANGVERSION=$erlangversion \
5154
ELIXIRVERSION=$elixirversion \
5255
NODEVERSION=$nodeversion \
53-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
56+
CLOUSEAUJDKVERSION=$clouseaujdkversion \
57+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseaujdk
58+
59+
# This are needed for the Clouseau integration
60+
ENV CLOUSEAU_JAVA_HOME=/opt/java/clouseaujdk
61+
ENV PATH=/usr/local/lib/erlang/bin:${PATH}
5462

5563
# Allow Jenkins to sudo
5664
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

0 commit comments

Comments
 (0)