diff --git a/.jdkw b/.jdkw index 16e417d..36e45d1 100644 --- a/.jdkw +++ b/.jdkw @@ -1,5 +1,4 @@ JDKW_RELEASE=latest JDKW_DIST=zulu -JDKW_BUILD=8.38.0.13 -JDKW_VERSION=8.0.212 -JDKW_VERBOSE=true +JDKW_BUILD=17.36.13-ca +JDKW_VERSION=17.0.4 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 49c3f22..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -cache: - directories: - - $HOME/.m2 - - $HOME/.jdk -sudo: false -env: - global: - - TARGET=install - - secure: R9PFMZWhbxtTIWy7h5LRCAJepgrFdBzu7/3JvwIDuyaO8y92Zw9Zx3RvSUgx2XGSMRnrMqnFeA1ecW4o4p00kYHlR7P9XM/DJxv5ZLTDaPk/MYH+0V1GT+giYNnlHiExqROCHOd19Zfh6TmPHq6w57Ln5WUQ929Gn+zy5NAGz68TDG0MtqTp3zkeZIBq3xw9+P7rXqN4qvG0hD/9v9mWW66fBRZL+gRWMz+qmfSPWeO9NQp8t3tnnlZXfLLJkOG/fQUkm8UNQsYCnv2XckvdxBYLcOLxtPg+pvYMgUbA8w01LO+wbRcS56PUX1nzuxy1wh4bv9C1RuklbGGNi887uq0gC9o0ZzXk5yLyPrX7XapVIicsYXdZerj94aDKj/pqw19vnuJqQ4eBGhCSqy9ED+ZnDoarG30seVt5AD214Z79vv86IaH3cwYD88VthszmusCnGwpHz1BV5uHVyEk9prvwvs+aKqf+a/lHnswXGyWV828mtpG0ZAvYm9NkJhBCytuQXBI9xwXJJYhZfMpP/EKJWBNCH/dqfQ4w05zWITJdDpvixDHvuuD+2Blt81lIoJyeCxQCwsTTirGcaxCibvDeVsnvQThsYwFR89LFwY3nH9q8hFYI32rurX3bc9SpcU7MJlz/280HQt4wPqqPdKpTRVatwNOK7yxdX0NF5Sk= - - secure: jMZmqw0/uxZ6PbwTZXXWFTa4zwJpBEzEPXps8SHYHPIj3lGtyDbQ+e5iuDeN/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E5AdrUoYPbzR6YzAqAfyEx9tBZ0XV6kxdThMp5hQ0QFixN36TInYfo6dHZHa3JwAc3uckchnl3UxYdubIaaiWeUfs3IsUygO54HMi/FnlBWwlnWVeaCcBB4w6Oc4rs07i6DZLIkPPbWdWEw9DO2+39bUFS6p9DgaqntZ6vgkyg53jjjjP3LP7YR6WLVg24HlHYw62u1E/ZUgrcQjQjAeeDWdw0P1x0pC80lW8= -install: true -before_script: -- gpg --import arpnetworking.key -- if [ \( -n "${TRAVIS_TAG}" \) -a "${TRAVIS_PULL_REQUEST}" = "false" ]; then export TARGET="deploy -P release --settings settings.xml"; fi; -script: -- ./jdk-wrapper.sh ./mvnw clean ${TARGET} -U diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..8af99db --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,58 @@ +pipeline { + agent { + kubernetes { + defaultContainer 'ubuntu' + activeDeadlineSeconds 3600 + idleMinutes 15 + } + } + stages { + stage('Init') { + steps { + checkout scm + script { + def m = (env.GIT_URL =~ /(\/|:)(([^\/]+)\/)?(([^\/]+?)(\.git)?)$/) + if (m) { + org = m.group(3) + repo = m.group(5) + } + } + } + } + stage('Setup build') { + when { not { buildingTag() } } + steps { + script { + target = "verify" + } + } + } + stage('Setup release') { + when { buildingTag(); not { changeRequest() } } + steps { + script { + target = "deploy -P release --settings settings.xml" + } + sh 'gpg --batch --import arpnetworking.key' + } + } + stage('Build') { + steps { + withCredentials([usernamePassword(credentialsId: 'jenkins-dockerhub', usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD'), + usernamePassword(credentialsId: 'jenkins-ossrh', usernameVariable: 'OSSRH_USER', passwordVariable: 'OSSRH_PASS'), + string(credentialsId: 'jenkins-gpg', variable: 'GPG_PASS')]) { + withMaven { + sh "./jdk-wrapper.sh ./mvnw $target -U -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Ddocker.verbose=true" + } + } + } + } + } + post('Analysis') { + always { + recordIssues( + enabledForFailure: true, aggregatingResults: true, + tools: [java(), checkStyle(reportEncoding: 'UTF-8'), spotBugs()]) + } + } +} diff --git a/jdk-wrapper.sh b/jdk-wrapper.sh index aa955d8..7c7ace0 100755 --- a/jdk-wrapper.sh +++ b/jdk-wrapper.sh @@ -17,6 +17,12 @@ # For documentation please refer to: # https://github.com/KoskiLabs/jdk-wrapper/blob/master/README.md +HTTP_PROTOCOL="http" +FILE_PROTOCOL="file" + +LATEST_RELEASE="latest" +SNAPSHOT_RELEASE="snapshot" + log_err() { l_prefix=$(date +'%H:%M:%S') printf "[%s] %s\\n" "${l_prefix}" "$@" 1>&2; @@ -42,35 +48,63 @@ safe_command() { checksum() { l_file="$1" - checksum_exec="" + l_checksum_exec="" + l_checksum_args="" if command -v sha256sum > /dev/null; then - checksum_exec="sha256sum" + l_checksum_exec="sha256sum" elif command -v shasum > /dev/null; then - checksum_exec="shasum -a 256" + l_checksum_exec="shasum" + l_checksum_args="-a 256" elif command -v sha1sum > /dev/null; then - checksum_exec="sha1sum" + l_checksum_exec="sha1sum" elif command -v md5 > /dev/null; then - checksum_exec="md5" + l_checksum_exec="md5" fi - if [ -z "${checksum_exec}" ]; then + if [ -z "${l_checksum_exec}" ]; then log_err "ERROR: No supported checksum command found!" exit 1 fi - "${checksum_exec}" < "${l_file}" + ${l_checksum_exec} ${l_checksum_args} < "${l_file}" } rand() { awk 'BEGIN {srand();printf "%d\n", (rand() * 10^8);}' } -download_if_needed() { - file="$1" - path="$2" - if [ ! -f "${path}/${file}" ]; then - jdkw_url="${JDKW_BASE_URI}/releases/download/${JDKW_RELEASE}/${file}" - log_out "Downloading ${file} from ${jdkw_url}" - safe_command "curl ${curl_options} -f -k -L -o \"${path}/${file}\" \"${jdkw_url}\"" - safe_command "chmod +x \"${path}/${file}\"" +get_protocol() { + case "${JDKW_BASE_URI}" in + http://*|https://*) + printf "%s" "${HTTP_PROTOCOL}" + ;; + file://*) + printf "%s" "${FILE_PROTOCOL}" + ;; + *) + log_err "ERROR: Unsupported protocol in JDKW_BASE_URI: ${JDKW_BASE_URI}" + exit 1 + esac +} + +obtain_if_needed() { + l_file="$1" + l_target_path="$2" + if [ ! -f "${l_target_path}/${l_file}" ]; then + case "${JDKW_BASE_URI}" in + http://*|https://*) + l_jdkw_url="${JDKW_BASE_URI}/releases/download/${JDKW_RELEASE}/${l_file}" + log_out "Downloading ${l_file} from ${l_jdkw_url}" + safe_command "curl ${curl_options} -f -k -L -o \"${l_target_path}/${l_file}\" \"${l_jdkw_url}\"" + ;; + file://*) + l_jdkw_path="${JDKW_BASE_URI#file://}/${l_file}" + log_out "Copying ${l_file} from ${l_jdkw_path}" + safe_command "cp \"${l_jdkw_path}\" \"${l_target_path}/${l_file}\"" + ;; + *) + log_err "ERROR: Unsupported protocol in JDKW_BASE_URI: ${JDKW_BASE_URI}" + exit 1 + esac + safe_command "chmod +x \"${l_target_path}/${l_file}\"" fi } @@ -96,7 +130,6 @@ done < "${l_fifo}" safe_command "rm \"${l_fifo}\"" # Process (but do not load) properties from command line arguments -command= cmd_configuration= for arg in "$@"; do jdkw_arg=$(echo "${arg}" | grep '^JDKW_.*') @@ -107,13 +140,6 @@ for arg in "$@"; do if [ -n "${jdkw_arg}" ]; then cmd_configuration="${cmd_configuration}${arg} " fi - case "${arg}" in - *\'*) - arg=$(printf "%s" "$arg" | sed "s/'/'\"'\"'/g") - ;; - *) : ;; - esac - command="${command} '${arg}'" done # Default base directory to current working directory @@ -142,7 +168,10 @@ if [ -z "${JDKW_BASE_URI}" ]; then JDKW_BASE_URI="https://github.com/KoskiLabs/jdk-wrapper" fi if [ -z "${JDKW_RELEASE}" ]; then - JDKW_RELEASE="latest" + JDKW_RELEASE="${LATEST_RELEASE}" + if [ $(get_protocol) = "${FILE_PROTOCOL}" ]; then + JDKW_RELEASE="${SNAPSHOT_RELEASE}" + fi log_out "Defaulted to version ${JDKW_RELEASE}" fi if [ -z "${JDKW_TARGET}" ]; then @@ -154,7 +183,7 @@ if [ -z "${JDKW_VERBOSE}" ]; then fi # Resolve latest version -if [ "${JDKW_RELEASE}" = "latest" ]; then +if [ "${JDKW_RELEASE}" = "${LATEST_RELEASE}" ]; then latest_version_json="${TMPDIR:-/tmp}/jdkw-latest-version-$$.$(rand)" safe_command "curl ${curl_options} -f -k -L -o \"${latest_version_json}\" -H 'Accept: application/json' \"${JDKW_BASE_URI}/releases/latest\"" JDKW_RELEASE=$(sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/' < "${latest_version_json}") @@ -164,6 +193,10 @@ fi # Ensure target directory exists jdkw_path="${JDKW_TARGET}/jdkw/${JDKW_RELEASE}" +if [ -d "${jdkw_path}" ] && [ "${JDKW_RELEASE}" = "${SNAPSHOT_RELEASE}" ]; then + log_out "Removing target snapshot directory ${jdkw_path}" + safe_command "rm -rf \"${jdkw_path}\"" +fi if [ ! -d "${jdkw_path}" ]; then log_out "Creating target directory ${jdkw_path}" safe_command "mkdir -p \"${jdkw_path}\"" @@ -172,30 +205,8 @@ fi # Download the jdk wrapper version jdkw_impl="jdkw-impl.sh" jdkw_wrapper="jdk-wrapper.sh" -download_if_needed "${jdkw_impl}" "${jdkw_path}" -download_if_needed "${jdkw_wrapper}" "${jdkw_path}" - -# Execute the provided command - -# Run the command in the backround (with all the trouble that entails) -# NOTE: Alternatively convert this to an exec if we don't need to output the -# wrapper mismatch at the end; e.g. make that a hard precondition to running. -set -m -trap 'kill -TERM ${impl_pid}' TERM INT -"${jdkw_path}/${jdkw_impl}" "$@" & -impl_pid=$! -fg -wait ${impl_pid} > /dev/null 2>&1 -wait_result=$? -if [ ${wait_result} -ne 127 ]; then - result=${wait_result} -fi -trap - TERM INT -wait ${impl_pid} > /dev/null 2>&1 -wait_result=$? -if [ ${wait_result} -ne 127 ]; then - result=${wait_result} -fi +obtain_if_needed "${jdkw_impl}" "${jdkw_path}" +obtain_if_needed "${jdkw_wrapper}" "${jdkw_path}" # Check whether this wrapper is the one specified for this version jdkw_download="${jdkw_path}/${jdkw_wrapper}" @@ -204,6 +215,13 @@ if [ "$(checksum "${jdkw_download}")" != "$(checksum "${jdkw_current}")" ]; then printf "\e[0;31m[WARNING]\e[0m Your jdk-wrapper.sh file does not match the one in your JDKW_RELEASE.\n" printf "\e[0;32mUpdate your jdk-wrapper.sh to match by running:\e[0m\n" printf "cp \"%s\" \"%s\"\n" "${jdkw_download}" "${jdkw_current}" + sleep 3 fi -exit ${result} +# Execute the provided command +# NOTE: The requirements proved quite difficult to run this without exec. +# 1) Exit with the exit status of the child process +# 2) Allow running the wrapper in the background and terminating the child process +# 3) Allow the child process to read from standard input when not running in the background +exec "${jdkw_path}/${jdkw_impl}" "$@" + diff --git a/maven/maven-wrapper.properties b/maven/maven-wrapper.properties index 60c4522..9717dad 100644 --- a/maven/maven-wrapper.properties +++ b/maven/maven-wrapper.properties @@ -1,5 +1,5 @@ #Maven download properties -#Wed Sep 11 15:35:48 PDT 2019 -checksumAlgorithm=SHA1 +#Wed Jan 19 23:16:22 PST 2022 +distributionUrl=https\://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip verifyDownload=true -distributionUrl=https\://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip +checksumAlgorithm=SHA1 diff --git a/pom.xml b/pom.xml index e1cd6e4..820da59 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ com.arpnetworking.build arpnetworking-parent-pom - 2.0.5 + 3.0.9 @@ -68,13 +68,13 @@ - 1.18.3 - 4.0.3 + 2.0.4 + 4.7.1 2.2 3.0.2 - 4.13 - 2.23.4 - 1.7.30 + 4.13.2 + 4.7.0 + 1.7.36 diff --git a/spotbugs.exclude.xml b/spotbugs.exclude.xml index ca51a0d..b203a38 100644 --- a/spotbugs.exclude.xml +++ b/spotbugs.exclude.xml @@ -26,7 +26,11 @@ http://findbugs.sourceforge.net/bugDescriptions.html#DLS_DEAD_LOCAL_STORE --> - + + + + +