Skip to content

Commit

Permalink
Remove Java version checks (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Aug 24, 2023
1 parent b32d65d commit 34f53af
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
16 changes: 0 additions & 16 deletions deb/build/debian/jenkins.init
Expand Up @@ -33,22 +33,6 @@ check_arguments() {
return 2
fi

# Work out the JAVA version we are working with:
JAVA_VERSION=$("${JAVA}" -version 2>&1 | sed -n ';s/.* version "\([0-9]\{2,\}\|[0-9]\.[0-9]\)\..*".*/\1/p;')
if [ "${JAVA_VERSION}" = "21" ]; then
echo "Correct java version found" >&2
elif [ "${JAVA_VERSION}" = "17" ]; then
echo "Correct java version found" >&2
elif [ "${JAVA_VERSION}" = "11" ]; then
echo "Correct java version found" >&2
else
echo "Found an incorrect Java version" >&2
echo "Java version found:" >&2
"${JAVA}" -version >&2
echo "Aborting" >&2
return 2
fi

# Make sure we run as root, since setting the max open files through
# ulimit requires root access
if [ "$(id -u)" -gt 0 ]; then
Expand Down
18 changes: 0 additions & 18 deletions systemd/jenkins.sh
Expand Up @@ -33,21 +33,6 @@ infer_java_cmd() {
JENKINS_JAVA_CMD="$(command -v java)" || return "$?"
}

check_java_version() {
printf '%s' "${JENKINS_OPTS}" | grep -q '\--enable-future-java' && return 0

java_version=$("${JENKINS_JAVA_CMD}" -version 2>&1 |
sed -n ';s/.* version "\([0-9]\{2,\}\|[0-9]\.[0-9]\)\..*".*/\1/p;')

if [ -z "${java_version}" ]; then
return 1
elif [ "${java_version}" != "21" ] && [ "${java_version}" != "17" ] && [ "${java_version}" != "11" ]; then
return 1
else
return 0
fi
}

infer_jenkins_opts() {
inferred_jenkins_opts=""

Expand Down Expand Up @@ -120,9 +105,6 @@ main() {

infer_jenkins_opts

check_java_version ||
die "invalid Java version: $("${JENKINS_JAVA_CMD}" -version 2>&1)"

java_opts_tmp="${JAVA_OPTS}"
unset JAVA_OPTS
unset JENKINS_DEBUG_LEVEL
Expand Down

0 comments on commit 34f53af

Please sign in to comment.