Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:

# These run on every branch
flavor:
- core+ext/openjdk21/pg-15
- core+ext/openjdk17/pg-15
- core+ext/openjdk11/pg-11

branch: main
os: [ubuntu-24.04]
ruby: ['3.2']

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
# converted to "_" in the pdb-job-id below.

flavor:
- core+ext/openjdk21/pg-17
- core+ext/openjdk21/pg-16
- core+ext/openjdk17/pg-17
- core+ext/openjdk17/pg-16

Expand All @@ -49,6 +51,15 @@ jobs:
- flavor: int/openjdk17/pup-main/srv-main/pg-16/rich
os: ubuntu-24.04
ruby: '3.4'
- flavor: int/openjdk21/pup-main/srv-main/pg-17/rich
os: ubuntu-24.04
ruby: '3.2'
- flavor: int/openjdk21/pup-main/srv-main/pg-17/rich
os: ubuntu-24.04
ruby: '3.3'
- flavor: int/openjdk21/pup-main/srv-main/pg-17/rich
os: ubuntu-24.04
ruby: '3.4'

steps:
- name: Compute job outputs
Expand Down
3 changes: 2 additions & 1 deletion ext/bin/require-leiningen
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -uexo pipefail
script_home="$(cd "$(dirname "$0")" && pwd)"

# Default leiningen version
default=2.9.5
default=2.11.2

cmdname="$(basename "$0")"

Expand All @@ -21,6 +21,7 @@ declare -A known_hash
known_hash[2.9.1]=32acacc8354627724d27231bed8fa190d7df0356972e2fd44ca144c084ad4fc7
known_hash[2.9.4]=1e21276bad56f4f8f8afd605ddf0c4d047a5244724a8dc6e13c6c55cc53b3fee
known_hash[2.9.5]=79cc2c4aeddf829c393d31d80e6fddfd8b30cc1907a0e2f7cd73c93b300077f6
known_hash[2.11.2]=f83e3de252cb09d301f18f1912acffa807b54c1c9a96772ae63847a946032bd4

# Verify two arguments were given
test "$#" -eq 2 || misuse
Expand Down
2 changes: 1 addition & 1 deletion ext/test/top-level-cli
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ case "$jdkver" in
expected_help_warnings=60
expected_version_warnings=60
;;
11 | 17)
11 | 17 | 21)
;;
*)
echo "JDK version '$jdkver' is not supported" 1>&2
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@
8 "-Djava.security.properties==dev-resources/jdk8-fips-security"
11 "-Djava.security.properties==dev-resources/jdk11on-fips-security"
17 "-Djava.security.properties==dev-resources/jdk11on-fips-security"
(throw (ex-info "Unsupported major Java version. Expects 8, 11, or 17."
{:major feature :minor interim})))))}]
(do)
)))}]
:kondo {:dependencies [[clj-kondo "2024.05.24"]]}
:ezbake {:dependencies ^:replace [;; NOTE: we need to explicitly pass in `nil` values
;; for the version numbers here in order to correctly
Expand Down
16 changes: 6 additions & 10 deletions src/puppetlabs/puppetdb/cli/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,26 @@

(def err-exit-status 2)

;; FIXME: maybe change this to rely on java.lang.Runtime$Version for
;; jdk > 8 (cf. pdb-jdk-ver in project.clj).

;; Testing hook
(defn java-version [] (System/getProperty "java.version"))

(def supported-java-version "17")

(defn jdk-support-status
"Returns :official, :tested, :deprecated, :unknown, or :no."
"Returns :official, :tested, :deprecated, :unknown, or :unsupported."
[version]
(cond
(re-matches #"1\.[1234567]($|(\..*))" version) :no
(re-matches #"1\.[1234567]($|(\..*))" version) :unsupported
(re-matches #"1\.[89]($|(\..*))" version) :deprecated
(re-matches #"10($|(\..*))" version) :deprecated
(re-matches (re-pattern (str supported-java-version "($|(\\..*))")) version) :official
(re-matches #"11($|(\..*))" version) :tested
(re-matches #"17($|(\..*))" version) :official
(re-matches #"21($|(\..*))" version) :tested
:else :unknown))

(defn jdk-unsupported-msg [version]
(let [status (jdk-support-status version)]
(case status
(:unknown) {:warn (trs "JDK {0} is neither tested nor supported. Please use JDK {1}" version supported-java-version)}
(:deprecated) {:warn (trs "JDK {0} is deprecated, please upgrade to JDK {1}" version supported-java-version)}
(:unknown) {:warn (trs "JDK {0} is neither tested nor supported. Please use JDK 11, 17 or 21" version)}
(:deprecated) {:warn (trs "JDK {0} is deprecated, please upgrade to JDK 11, 17 or 21" version)}
(:official :tested) nil
{:error (trs "PuppetDB doesn''t support JDK {0}" version)})))

Expand Down
12 changes: 6 additions & 6 deletions test/puppetlabs/puppetdb/cli/util_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
[puppetlabs.puppetdb.cli.util :refer [jdk-support-status]]))

(deftest jdk-support-status-behavior
(is (= :no (jdk-support-status "1.5")))
(is (= :no (jdk-support-status "1.5.0")))
(is (= :no (jdk-support-status "1.6")))
(is (= :no (jdk-support-status "1.6.0")))
(is (= :unsupported (jdk-support-status "1.5")))
(is (= :unsupported (jdk-support-status "1.5.0")))
(is (= :unsupported (jdk-support-status "1.6")))
(is (= :unsupported (jdk-support-status "1.6.0")))
(is (= :unknown (jdk-support-status "1.60")))
(is (= :unknown (jdk-support-status "1.60.1")))
(is (= :unknown (jdk-support-status "huh?")))
(is (= :no (jdk-support-status "1.7")))
(is (= :no (jdk-support-status "1.7.0")))
(is (= :unsupported (jdk-support-status "1.7")))
(is (= :unsupported (jdk-support-status "1.7.0")))
(is (= :deprecated (jdk-support-status "1.8")))
(is (= :deprecated (jdk-support-status "1.8.0")))
(is (= :deprecated (jdk-support-status "1.9")))
Expand Down