diff --git a/adopt-github-release/build.gradle b/adopt-github-release/build.gradle index 9de1703..e29cb75 100644 --- a/adopt-github-release/build.gradle +++ b/adopt-github-release/build.gradle @@ -11,10 +11,11 @@ repositories { } application { mainClassName = 'net.adoptium.release.UploadFiles' + applicationDefaultJvmArgs = ['-Xmx4g'] } dependencies { - implementation 'org.codehaus.groovy:groovy-all:2.5.6' - implementation 'org.kohsuke:github-api:1.127' + implementation 'org.codehaus.groovy:groovy-all:3.0.20' + implementation 'org.kohsuke:github-api:1.318' compileOnly group: 'junit', name: 'junit', version: '4.12' } diff --git a/adopt-github-release/gradle/wrapper/gradle-wrapper.properties b/adopt-github-release/gradle/wrapper/gradle-wrapper.properties index e750102..a595206 100644 --- a/adopt-github-release/gradle/wrapper/gradle-wrapper.properties +++ b/adopt-github-release/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/adopt-github-release/src/main/groovy/net/adoptium/release/UploadFiles.groovy b/adopt-github-release/src/main/groovy/net/adoptium/release/UploadFiles.groovy index d104cb5..708f55e 100644 --- a/adopt-github-release/src/main/groovy/net/adoptium/release/UploadFiles.groovy +++ b/adopt-github-release/src/main/groovy/net/adoptium/release/UploadFiles.groovy @@ -19,11 +19,13 @@ class UploadAdoptReleaseFiles { private final String version private final String server private final String org + private final boolean isDevKit - UploadAdoptReleaseFiles(String tag, String description, boolean release, String version, String server, String org, List files) { + UploadAdoptReleaseFiles(String tag, String description, boolean release, boolean isDevKit, String version, String server, String org, List files) { this.tag = tag this.description = description this.release = release + this.isDevKit = isDevKit this.files = files this.version = version this.server = server @@ -31,7 +33,12 @@ class UploadAdoptReleaseFiles { } void release() { - def grouped = files.groupBy { + GHRepository repo = getRepo("adopt") + GHRelease release = getRelease(repo) + if (isDevKit) { + uploadFiles(release, files) + } else { + def grouped = files.groupBy { switch (it.getName()) { // Only release file names containing certain patterns // to avoid publication of non-temurin builds @@ -40,10 +47,9 @@ class UploadAdoptReleaseFiles { case ~/.*release-notes.*/: "adopt"; break; case ~/.*AQAvitTapFiles.*/: "adopt"; break; } + } + uploadFiles(release, grouped.get("adopt")) } - GHRepository repo = getRepo("adopt") - GHRelease release = getRelease(repo) - uploadFiles(release, grouped.get("adopt")) } private GHRepository getRepo(String vendor) { @@ -66,12 +72,18 @@ class UploadAdoptReleaseFiles { (int) TimeUnit.SECONDS.toMillis(120))) println("Using Github org:'${org}'") - // jdk11 => 11 - def numberVersion = version.replaceAll(/[^0-9]/, "") - def repoName = "${org}/temurin${numberVersion}-binaries" - if (vendor != "adopt") { - repoName = "${org}/open${version}-${vendor}-binaries" + def repoName + if (isDevKit) { + repoName = "${org}/devkit-binaries" + } else { + // jdk11 => 11 + def numberVersion = version.replaceAll(/[^0-9]/, "") + repoName = "${org}/temurin${numberVersion}-binaries" + + if (vendor != "adopt") { + repoName = "${org}/open${version}-${vendor}-binaries" + } } return github.getRepository(repoName) @@ -120,6 +132,7 @@ static void main(String[] args) { options.t, options.d, options.r, + options.k, options.v, options.s, options.o, @@ -137,6 +150,7 @@ private OptionAccessor parseArgs(String[] args) { t longOpt: 'tag', type: String, args: 1, 'Tag name' d longOpt: 'description', type: String, args: 1, 'Release description' r longOpt: 'release', 'Is a release build' + k longOpt: 'isDevKit', 'Is a DevKit build' h longOpt: 'help', 'Show usage information' s longOpt: 'server', type: String, args: 1, optionalArg: true, defaultValue: 'https://api.github.com', 'Github server' o longOpt: 'org', type: String, args: 1, optionalArg: true, defaultValue: 'adoptium', 'Github org' diff --git a/sbin/PublishDevKit.sh b/sbin/PublishDevKit.sh new file mode 100755 index 0000000..cab4872 --- /dev/null +++ b/sbin/PublishDevKit.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +################################################################### +# +# PublishDevKit.sh TAG +# +# This script will take the passed in TAG +# then use a Groovy scripy with the Github API to create a +# release (or update an existing release) up in GitHub +# +################################################################### +set -eo pipefail + +# eg: artifact: +# devkit-gcc-11.3.0-Centos7.6.1810-b01-x86_64-linux-gnu.tar.gz + +# (compiler ) (version ) (sysroot ) (build )-(arch )(suffix ) (extension ) +regex="^devkit-([[:alnum:]]+)-([[:digit:]\.]+)-([[:alnum:]\.]+)-([[:alnum:]]+)-([[:alnum:]\_]+)(-linux-gnu)\.(tar\.xz|tar\.xz\.sha256\.txt|tar\.xz\.sig)$"; + +# Check that a TAG has been passed in. +if [ -z "${TAG}" ]; then + echo "Must have a tag set" + exit 1 +fi + +# Set the GitHub server to push to +if [ -z "${GITHUB_SERVER}" ]; then + server="" +else + server="--server \"${GITHUB_SERVER}\"" +fi + +# Set the GitHub org to push to +if [ -z "${GITHUB_ORG}" ]; then + org="" +else + org="--org \"${GITHUB_ORG}\"" +fi + +# Validate all file names with regex +valid_files=true +for file in devkit-* + do + if [[ $file =~ $regex ]]; + then + echo "DevKit file: $file" + FILE_COMPILER=${BASH_REMATCH[1]}; + FILE_VERSION=${BASH_REMATCH[2]}; + FILE_SYSROOT=${BASH_REMATCH[3]}; + FILE_BUILD=${BASH_REMATCH[4]}; + FILE_ARCH=${BASH_REMATCH[5]}; + FILE_SUFFIX=${BASH_REMATCH[6]}; + FILE_EXTENSION=${BASH_REMATCH[7]}; + + file_tag="${FILE_COMPILER}-${FILE_VERSION}-${FILE_SYSROOT}-${FILE_BUILD}" + + # Validate tarball is valid for publishing as TAG release + if [[ "${file_tag}" != "${TAG}" ]]; then + echo "ERROR: devkit file is not valid for publishing under release tag ${TAG} : ${file}" + valid_files=false + fi + else + echo "ERROR: devkit file does not match required regex pattern: ${file}" + valid_files=false + fi + done + +if [ "$valid_files" == "false" ]; then + echo "ERROR: Some devkit filenames are not valid..." + exit 1 +fi + +files=$(find $PWD \( -name "devkit-*" \) | tr '\n' ' ') + +if [ "$DRY_RUN" == "false" ]; then + description="Release of $TAG" + + # Hand over to the Groovy script that uses the GitHub API to actually create the release and upload files + cd adopt-github-release || exit 1 + chmod +x gradlew + GRADLE_USER_HOME=./gradle-cache ./gradlew --no-daemon run --args="--isDevKit --release --version \"${TAG}\" --tag \"${TAG}\" --description \"${description}\" ${server} ${org} $files" +fi + diff --git a/sbin/Release.sh b/sbin/Release.sh index be1349e..633c815 100755 --- a/sbin/Release.sh +++ b/sbin/Release.sh @@ -39,9 +39,10 @@ timestampRegex="[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}-[[:digit:]]{2}-[[:d # OpenJDK 18U -jdk-sources 2020-06-06-16-36 .tar.gz # OpenJDK 11_ -jdk x64_ linux_ _fast_startup_ 11_28 .tar.gz # OpenJDK -debugimage aarch64_ linux_ hotspot_ 2023-02-16-12-32 .tar.gz +# OpenJDK 17U_ -jdk x64_ linux_ hotspot_ 17.0.10_5-ea .tar.gz # -# (version ) (type ) (arch ) (os ) (variant ) (timestamp or version ) (extension ) -regex="OpenJDK([[:digit:]]*)U?(-jre|-jdk|-debugimage|-static-libs-glibc|-static-libs|-static-libs-musl|-testimage|-jdk-sources)_([[:alnum:]\-]+_)?([[:alnum:]\-]+_)?([[:alnum:]\-_]+_)?([[:digit:]\-]+|[[:alnum:]\._]+)\.(tar\.gz|zip|pkg|msi)"; +# (version ) (type ) (arch ) (os ) (variant ) (timestamp or version ) (extension ) +regex="OpenJDK([[:digit:]]*)U?(-jre|-jdk|-debugimage|-static-libs-glibc|-static-libs|-static-libs-musl|-testimage|-jdk-sources)_([[:alnum:]\-]+_)?([[:alnum:]\-]+_)?([[:alnum:]\-_]+_)?([[:digit:]\-]+|[[:alnum:]\._\-]+)\.(tar\.gz|zip|pkg|msi)"; regexArchivesOnly="${regex}$"; diff --git a/sbin/releaseCheck.sh b/sbin/releaseCheck.sh index e1bc08e..6cfb6c4 100755 --- a/sbin/releaseCheck.sh +++ b/sbin/releaseCheck.sh @@ -15,7 +15,7 @@ echo Grabbing information from https://github.com/adoptium/temurin${TEMURIN_VERS FILTER=$(echo $TEMURIN_TAG | sed 's/+/%2B/g') echo FILTER IS: $FILTER curl -q https://api.github.com/repos/adoptium/temurin${TEMURIN_VERSION}-binaries/releases | - grep "$FILTER" | + grep "/$FILTER/" | awk -F'"' '/browser_download_url/{print$4}' > releaseCheck.$$.tmp || exit 1 #### LINUX (ALL) @@ -59,7 +59,7 @@ done ### Alpine - Same number of artifacts as Linux so don't adjust EXPECTED for ARCH in x64 aarch64; do # Alpine/aarch64 is only included from JDK21 - if [ "${TEMURIN_VERSION}" -ge 21 -o "${ARCH}" == "x64" ]; then + if [ "${TEMURIN_VERSION}" -ge 21 -o "${ARCH}" = "x64" ]; then ACTUAL=$(cat releaseCheck.$$.tmp | grep ${ARCH}_alpine | wc -l) if [ $ACTUAL -eq $EXPECTED ] then