diff --git a/26/jdk/bookworm/Dockerfile b/26/bookworm/Dockerfile similarity index 100% rename from 26/jdk/bookworm/Dockerfile rename to 26/bookworm/Dockerfile diff --git a/26/jdk/oraclelinux8/Dockerfile b/26/oraclelinux8/Dockerfile similarity index 100% rename from 26/jdk/oraclelinux8/Dockerfile rename to 26/oraclelinux8/Dockerfile diff --git a/26/jdk/oraclelinux9/Dockerfile b/26/oraclelinux9/Dockerfile similarity index 100% rename from 26/jdk/oraclelinux9/Dockerfile rename to 26/oraclelinux9/Dockerfile diff --git a/26/jdk/slim-bookworm/Dockerfile b/26/slim-bookworm/Dockerfile similarity index 100% rename from 26/jdk/slim-bookworm/Dockerfile rename to 26/slim-bookworm/Dockerfile diff --git a/26/jdk/slim-trixie/Dockerfile b/26/slim-trixie/Dockerfile similarity index 100% rename from 26/jdk/slim-trixie/Dockerfile rename to 26/slim-trixie/Dockerfile diff --git a/26/jdk/trixie/Dockerfile b/26/trixie/Dockerfile similarity index 100% rename from 26/jdk/trixie/Dockerfile rename to 26/trixie/Dockerfile diff --git a/26/jdk/windows/nanoserver-ltsc2022/Dockerfile b/26/windows/nanoserver-ltsc2022/Dockerfile similarity index 90% rename from 26/jdk/windows/nanoserver-ltsc2022/Dockerfile rename to 26/windows/nanoserver-ltsc2022/Dockerfile index bc71143b..90fe8b69 100644 --- a/26/jdk/windows/nanoserver-ltsc2022/Dockerfile +++ b/26/windows/nanoserver-ltsc2022/Dockerfile @@ -22,7 +22,7 @@ USER ContainerUser # > ENV JAVA_VERSION 26-ea+22 -COPY --from=openjdk:26-ea-22-jdk-windowsservercore-ltsc2022 $JAVA_HOME $JAVA_HOME +COPY --from=openjdk:26-ea-22-windowsservercore-ltsc2022 $JAVA_HOME $JAVA_HOME RUN echo Verifying install ... \ && echo javac --version && javac --version \ diff --git a/26/jdk/windows/nanoserver-ltsc2025/Dockerfile b/26/windows/nanoserver-ltsc2025/Dockerfile similarity index 90% rename from 26/jdk/windows/nanoserver-ltsc2025/Dockerfile rename to 26/windows/nanoserver-ltsc2025/Dockerfile index b39e1854..e0454476 100644 --- a/26/jdk/windows/nanoserver-ltsc2025/Dockerfile +++ b/26/windows/nanoserver-ltsc2025/Dockerfile @@ -22,7 +22,7 @@ USER ContainerUser # > ENV JAVA_VERSION 26-ea+22 -COPY --from=openjdk:26-ea-22-jdk-windowsservercore-ltsc2025 $JAVA_HOME $JAVA_HOME +COPY --from=openjdk:26-ea-22-windowsservercore-ltsc2025 $JAVA_HOME $JAVA_HOME RUN echo Verifying install ... \ && echo javac --version && javac --version \ diff --git a/26/jdk/windows/windowsservercore-ltsc2022/Dockerfile b/26/windows/windowsservercore-ltsc2022/Dockerfile similarity index 100% rename from 26/jdk/windows/windowsservercore-ltsc2022/Dockerfile rename to 26/windows/windowsservercore-ltsc2022/Dockerfile diff --git a/26/jdk/windows/windowsservercore-ltsc2025/Dockerfile b/26/windows/windowsservercore-ltsc2025/Dockerfile similarity index 100% rename from 26/jdk/windows/windowsservercore-ltsc2025/Dockerfile rename to 26/windows/windowsservercore-ltsc2025/Dockerfile diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template index d9d36fec..83df4db5 100644 --- a/Dockerfile-linux.template +++ b/Dockerfile-linux.template @@ -1,37 +1,18 @@ -{{ - def is_alpine: - env.variant | startswith("alpine") - ; - def alpine_version: - env.variant | ltrimstr("alpine") --}} {{ def is_oracle: env.variant | startswith("oraclelinux") ; def oracle_version: env.variant | ltrimstr("oraclelinux") --}} -{{ - def is_debian: - is_alpine or is_oracle | not ; def is_debian_slim: - is_debian and (env.variant | startswith("slim-")) + env.variant | startswith("slim-") ; def debian_suite: env.variant | ltrimstr("slim-") -}} {{ - if is_alpine then ( --}} -FROM alpine:{{ alpine_version }} - -RUN apk add --no-cache java-cacerts - -ENV JAVA_HOME /opt/openjdk-{{ env.version }} -{{ - ) elif is_oracle then ( + if is_oracle then ( -}} FROM oraclelinux:{{ oracle_version }}-slim @@ -57,13 +38,7 @@ FROM {{ if is_debian_slim then "debian:" + debian_suite + "-slim" else - "buildpack-deps:" + debian_suite + ( - if env.javaType == "jdk" then - "-scm" - else - "-curl" - end - ) + "buildpack-deps:" + debian_suite + "-scm" end }} @@ -96,30 +71,18 @@ ENV JAVA_HOME /usr/local/openjdk-{{ env.version }} -}} ENV PATH $JAVA_HOME/bin:$PATH -{{ if is_alpine then "" else ( -}} # Default to UTF-8 file.encoding ENV LANG C.UTF-8 -{{ ) end -}} -{{ def java_version: if is_alpine then .alpine.version else .version end -}} # https://jdk.java.net/ # > # > Java Development Kit builds, from Oracle # > -ENV JAVA_VERSION {{ java_version }} -{{ if is_alpine then ( -}} -# "For Alpine Linux, builds are produced on a reduced schedule and may not be in sync with the other platforms." -{{ ) else "" end -}} +ENV JAVA_VERSION {{ .version }} {{ - def arches: - if is_alpine then .alpine else . end - | .[env.javaType].arches - ; def get_arch_command: - if is_alpine then - "apk --print-arch" - elif is_oracle then + if is_oracle then "rpm --query --queryformat='%{ARCH}' rpm" else "dpkg --print-architecture" @@ -131,10 +94,7 @@ ENV JAVA_VERSION {{ java_version }} # output is a shell "case" expression for matching the output of running "get_arch_command" # - "i[3456]86", "aarch64", "x86_64", etc . as $bashbrewArch - | if is_alpine then { - amd64: "x86_64", - arm64v8: "aarch64", - } elif is_oracle then { + | if is_oracle then { amd64: "x86_64", arm64v8: "aarch64", } else { @@ -148,11 +108,7 @@ ENV JAVA_VERSION {{ java_version }} if is_oracle then "curl -fL -o" else - [ - "wget", - if is_alpine then empty else "--progress=dot:giga" end, - "-O" - ] | join(" ") + "wget --progress=dot:giga -O" end -}} RUN set -eux; \ @@ -161,7 +117,8 @@ RUN set -eux; \ case "$arch" in \ {{ [ - arches | to_entries[] + .arches + | to_entries[] | select(.key | startswith("windows-") | not) | .key as $bashbrewArch | .value | ( @@ -189,8 +146,8 @@ RUN set -eux; \ \ {{ ) else "" end -}} {{ wget_command }} openjdk.tgz "$downloadUrl"; \ -{{ if [ arches[] ] | any(has("sha256")) then ( -}} - echo "$downloadSha256 *openjdk.tgz" | sha256sum {{ if is_alpine then "-c" else "--strict --check" end }} -; \ +{{ if .arches | any(has("sha256")) then ( -}} + echo "$downloadSha256 *openjdk.tgz" | sha256sum --strict --check -; \ {{ ) else "" end -}} \ mkdir -p "$JAVA_HOME"; \ @@ -208,11 +165,7 @@ RUN set -eux; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ \ {{ ) else "" end -}} -{{ if is_alpine then ( -}} - rm -rf "$JAVA_HOME/lib/security/cacerts"; \ -# see "java-cacerts" package installed above (which maintains "/etc/ssl/certs/java/cacerts" for us) - ln -sT /etc/ssl/certs/java/cacerts "$JAVA_HOME/lib/security/cacerts"; \ -{{ ) elif is_oracle then ( -}} +{{ if is_oracle then ( -}} rm -rf "$JAVA_HOME/lib/security/cacerts"; \ # see "update-ca-trust" script which creates/maintains this cacerts bundle ln -sT /etc/pki/ca-trust/extracted/java/cacerts "$JAVA_HOME/lib/security/cacerts"; \ @@ -249,13 +202,9 @@ RUN set -eux; \ java -Xshare:dump; \ \ # basic smoke test -{{ if env.javaType == "jdk" then ( -}} fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \ javac --version; \ java --version # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) CMD ["jshell"] -{{ ) else ( -}} - java --version -{{ ) end -}} diff --git a/Dockerfile-windows.template b/Dockerfile-windows.template index 3df7d5ef..a10ba7c9 100644 --- a/Dockerfile-windows.template +++ b/Dockerfile-windows.template @@ -1,6 +1,17 @@ -FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }} +{{ +def windows_variant: # "servercore", "nanoserver" + env.variant + | split("/")[-1] + | split("-")[0] + | ltrimstr("windows") +; +def windows_release: # "ltsc2025", "ltsc2022" + env.variant + | split("-")[-1] +-}} +FROM mcr.microsoft.com/windows/{{ windows_variant }}:{{ windows_release }} -{{ if env.windowsVariant == "servercore" then ( -}} +{{ if windows_variant == "servercore" then ( -}} # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -40,19 +51,19 @@ USER ContainerUser # > Java Development Kit builds, from Oracle # > ENV JAVA_VERSION {{ .version }} -{{ if env.windowsVariant == "servercore" then ( -}} +{{ if windows_variant == "servercore" then ( -}} {{ # TODO $env:PROCESSOR_ARCHITECTURE for arm64v8 someday (https://superuser.com/a/1441469/101945) -}} -ENV JAVA_URL {{ .[env.javaType].arches["windows-amd64"].url }} -{{ if .[env.javaType].arches["windows-amd64"] | has("sha256") then ( -}} -ENV JAVA_SHA256 {{ .[env.javaType].arches["windows-amd64"].sha256 }} +ENV JAVA_URL {{ .arches["windows-amd64"].url }} +{{ if .arches["windows-amd64"] | has("sha256") then ( -}} +ENV JAVA_SHA256 {{ .arches["windows-amd64"].sha256 }} {{ ) else "" end -}} {{ ) else "" end -}} -{{ if env.windowsVariant == "servercore" then ( -}} +{{ if windows_variant == "servercore" then ( -}} RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \ -{{ if .[env.javaType].arches["windows-amd64"] | has("sha256") then ( -}} +{{ if .arches["windows-amd64"] | has("sha256") then ( -}} Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_SHA256); \ if ((Get-FileHash openjdk.zip -Algorithm sha256).Hash -ne $env:JAVA_SHA256) { \ Write-Host 'FAILED!'; \ @@ -72,24 +83,18 @@ RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ Remove-Item openjdk.zip -Force; \ \ Write-Host 'Verifying install ...'; \ -{{ if env.javaType == "jdk" then ( -}} Write-Host ' javac --version'; javac --version; \ -{{ ) else "" end -}} Write-Host ' java --version'; java --version; \ \ Write-Host 'Complete.' {{ ) else ( -}} -COPY --from=openjdk:{{ .version | gsub("[+]"; "-") }}-{{ env.javaType }}-windowsservercore-{{ env.windowsRelease }} $JAVA_HOME $JAVA_HOME +COPY --from=openjdk:{{ .version | gsub("[+]"; "-") }}-windowsservercore-{{ windows_release }} $JAVA_HOME $JAVA_HOME RUN echo Verifying install ... \ -{{ if env.javaType == "jdk" then ( -}} && echo javac --version && javac --version \ -{{ ) else "" end -}} && echo java --version && java --version \ && echo Complete. {{ ) end -}} -{{ if env.javaType == "jdk" then ( -}} # "jshell" is an interactive REPL for Java (see https://en.wikipedia.org/wiki/JShell) CMD ["jshell"] -{{ ) else "" end -}} diff --git a/apply-templates.sh b/apply-templates.sh index 8f48dfa7..279e2e55 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -35,44 +35,27 @@ for version; do variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" eval "variants=( $variants )" - for javaType in jdk jre; do - export javaType + for variant in "${variants[@]}"; do + export variant - if ! hasJavaType="$(jq -r '.[env.version] | if has(env.javaType) then "1" else "" end' versions.json)" || [ -z "$hasJavaType" ]; then - continue - fi + dir="$version/$variant" + mkdir -p "$dir" - for variant in "${variants[@]}"; do - export variant + case "$variant" in + windows/*) + template='Dockerfile-windows.template' + ;; - if [ "$javaType" = 'jre' ] && [[ "$variant" == oraclelinux* ]]; then - continue # no Oracle-based JRE images (for now? gotta figure a few things out to do that) - fi + *) + template='Dockerfile-linux.template' + ;; + esac - dir="$version/$javaType/$variant" - mkdir -p "$dir" + echo "processing $dir ..." - case "$variant" in - windows/*) - variant="$(basename "$dir")" # "buster", "windowsservercore-1809", etc - windowsVariant="${variant%%-*}" # "windowsservercore", "nanoserver" - windowsRelease="${variant#$windowsVariant-}" # "ltsc2022", "1809", etc - windowsVariant="${windowsVariant#windows}" # "servercore", "nanoserver" - export windowsVariant windowsRelease - template='Dockerfile-windows.template' - ;; - - *) - template='Dockerfile-linux.template' - ;; - esac - - echo "processing $dir ..." - - { - generated_warning - gawk -f "$jqt" "$template" - } > "$dir/Dockerfile" - done + { + generated_warning + gawk -f "$jqt" "$template" + } > "$dir/Dockerfile" done done diff --git a/generate-stackbrew-library.jq b/generate-stackbrew-library.jq new file mode 100644 index 00000000..57daae4e --- /dev/null +++ b/generate-stackbrew-library.jq @@ -0,0 +1,108 @@ +to_entries + +| .[] +| .key as $major +| .value + +| if $ARGS.positional | length > 0 then + select(IN($major; $ARGS.positional[])) +else . end + +| ( + .version + | gsub("[+]"; "-") + # if fullVersion is only digits, add "-rc" to the end (because we're probably in the final-phases of pre-release before GA when we drop support from the image) + | if test("^[0-9.]+$") then + . + "-rc" + else . end + | if contains("-ea") or contains("-rc") then . else + error("invalid version; too GA: \(.) (\($major))") + end +) as $version + +# generate a list of "version tags", stopping the vector at the first "-ea" or "-rc" component suffix +# "AA-ea-BB.CC" -> [ "AA-ea-BB.CC", "AA-ea-BB", "AA-ea" ] +| [ + $version + | [ scan("(?x) ^[0-9a-z]+ | [.-][0-9a-z]+") ] # [ "AA", "-ea", "-BB", ".CC" ] + | label $stopEarly + | .[:length-range(length)] # [ "AA", "-ea", "-BB", ".CC" ], [ "AA", "-ea", "-BB" ], ... + | add # "AA-ea-BB.CC", "AA-ea-BB", "AA-ea", "AA" + | if endswith("-ea") or endswith("-rc") then + ., break $stopEarly + else . end +] as $versionTags + +# now inject all the "-jdk" variations of those too +| ($versionTags | map(. + "-jdk", .)) as $versionTags + +| first(.variants[] | select(startswith("oraclelinux"))) as $latestOracle +| first(.variants[] | select(startswith("slim-"))) as $latestSlim + +| .variants[] as $variant # "oraclelinux9", "slim-trixie", "windows/windowsservercore-ltsc2025" + +| ($variant | split("/")[-1]) as $variantName # "windowsservercore-ltsc2025", etc + +| [ + $variantName, + + if $variant == $latestOracle then + "oracle" + else empty end, + + if $variant == $latestSlim then + "slim" + else empty end, + + empty + + | $versionTags[] as $versionTag + | [ $versionTag, . | select(. != "") ] + | join("-") +] as $tags + +| [ + if $variant | startswith("windows/") then + $variantName | split("-")[0] + else empty end, + + if $variant == $latestOracle or ($variant | startswith("windows/windowsservercore-")) then + "" + else empty end, + + empty + + | $versionTags[] as $versionTag + | [ $versionTag, . | select(. != "") ] + | join("-") +] as $sharedTags + +| ( + .arches + | keys_unsorted + | map(select( + startswith("windows-") + | if $variant | startswith("windows/") then . else not end + )) +) as $arches + +| ( + "", + "Tags: \($tags | join(", "))", + if $sharedTags != [] then "SharedTags: \($sharedTags | join(", "))" else empty end, + "Directory: \($major)/\($variant)", + "Architectures: \($arches | join(", "))", + if $variant | startswith("windows/") then + $variant + | split("-")[-1] as $winver + | [ + if startswith("windows/nanoserver-") then + "nanoserver-" + $winver + else empty end, + "windowsservercore-" + $winver, + empty + ] + | "Constraints: " + join(", ") + else empty end, + empty +) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 668d8c4b..e461f8a6 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -1,269 +1,26 @@ #!/usr/bin/env bash set -Eeuo pipefail -declare -A aliases=( - # https://github.com/docker-library/openjdk/issues/505 - # https://github.com/docker-library/openjdk/pull/510#issue-1327751730 - # > Once Oracle stops publishing OpenJDK 18 builds, those will be removed - # > 19+ will be removed as soon as each release hits GA - # To prevent user breakage, we are not moving "latest", "jre" or "jdk" to early access builds; the last non-ea was 18 - #[18-jdk]='jdk latest' - #[18-jre]='jre' -) -defaultType='jdk' - -image="${1:-openjdk}" - self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -if [ "$#" -eq 0 ]; then - versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" - eval "set -- $versions" -fi - -# sort version numbers with highest first -IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS - -# get the most recent commit which modified any of "$@" -fileCommit() { - git log -1 --format='format:%H' HEAD -- "$@" -} +# get the most recent commit which modified any files related to a build context +commit="$(git log -1 --format='format:%H' HEAD -- '[^.]*/**')" -# get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" -dirCommit() { - local dir="$1"; shift - ( - cd "$dir" - files="$( - git show HEAD:./Dockerfile | awk ' - toupper($1) == "COPY" { - for (i = 2; i < NF; i++) { - if ($i ~ /^--from=/) { - next - } - print $i - } - } - ' - )" - fileCommit Dockerfile $files - ) -} - -getArches() { - local repo="$1"; shift - local officialImagesBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/" - - local parentRepoToArchesStr - parentRepoToArchesStr="$( - find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" ' - toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { - printf "%s%s\n", officialImagesBase, $2 - } - ' '{}' + \ - | sort -u \ - | xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"' - )" - eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )" -} -getArches 'openjdk' +# TODO fetch parent arches so we can exclude things from "versions.json" that our base image doesn't support (if any) +selfCommit="$(git log -1 --format='format:%H' HEAD -- "$self")" cat <<-EOH -# this file is generated via https://github.com/docker-library/openjdk/blob/$(fileCommit "$self")/$self +# this file is generated via https://github.com/docker-library/openjdk/blob/$selfCommit/$self Maintainers: Tianon Gravi (@tianon), Joseph Ferguson (@yosifkit) GitRepo: https://github.com/docker-library/openjdk.git +GitCommit: $commit EOH -# prints "$2$1$3$1...$N" -join() { - local sep="$1"; shift - local out; printf -v out "${sep//%/%%}%s" "$@" - echo "${out#$sep}" -} - -_latest() { - local javaVersion="$1"; shift - local variant="$1"; shift - - # "windowsservercore" variants should always be part of the "latest" tag - if [[ "$variant" == windowsservercore* ]]; then - return 0 - fi - - if [ "$javaVersion" -ge 12 ]; then - # version 12+ moves "latest" over to the Oracle-based builds (and includes Windows!) - if [ "$variant" = "$defaultOracleVariant" ]; then - return 0 - fi - else - # for versions < 12, the Debian variant should be "latest" - if [ "$variant" = "$defaultDebianVariant" ]; then - return 0 - fi - fi - - return 1 -} - -aliases() { - local javaVersion="$1"; shift - local javaType="$1"; shift - local fullVersion="$1"; shift - local variants=( "$@" ) - - if [[ "$fullVersion" =~ ^[0-9]+$ ]]; then - # if fullVersion is only digits, add "-rc" to the end (because we're probably in the final-phases of pre-release before GA when we drop support from the image) - fullVersion="$fullVersion-rc" - fi - - local bases=() - while [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do - bases+=( $fullVersion ) - fullVersion="${fullVersion%[.-]*}" - done - bases+=( $fullVersion ) - if [ "$javaVersion" != "$fullVersion" ]; then - bases+=( $javaVersion ) - fi - - local versionAliases=() - for base in "${bases[@]}"; do - versionAliases+=( "$base-$javaType" ) - if [ "$javaType" = "$defaultType" ]; then - versionAliases+=( "$base" ) - fi - done - - # add aliases and the prefixed versions (so the silly prefix versions come dead last) - versionAliases+=( ${aliases[$javaVersion-$javaType]:-} ) - - local variantAliases=() - local variant - for variant in "${variants[@]}"; do - case "$variant" in - latest) variantAliases+=( "${versionAliases[@]}" ) ;; - '') ;; - *) - local thisVariantAliases=( "${versionAliases[@]/%/-$variant}" ) - variantAliases+=( "${thisVariantAliases[@]//latest-/}" ) - ;; - esac - done - - echo "${variantAliases[@]}" -} - -for version; do - export version - - variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" - eval "variants=( $variants )" - - defaultOracleVariant="$(jq -r ' - .[env.version].variants - | map(select( - startswith("oraclelinux") - )) - | .[0] - ' versions.json)" - defaultDebianVariant="$(jq -r ' - .[env.version].variants - | map(select( - startswith("alpine") - or startswith("oraclelinux") - or startswith("slim-") - or startswith("windows/") - | not - )) - | .[0] - ' versions.json)" - defaultAlpineVariant="$(jq -r ' - .[env.version].variants - | map(select( - startswith("alpine") - )) - | .[0] - ' versions.json)" - - for javaType in jdk jre; do - export javaType - - for v in "${variants[@]}"; do - dir="$version/$javaType/$v" - [ -f "$dir/Dockerfile" ] || continue - - variant="$(basename "$v")" - export variant - - commit="$(dirCommit "$dir")" - - fullVersion="$(jq -r '.[env.version] | if env.variant | startswith("alpine") then .alpine.version else .version end | gsub("[+]"; "-")' versions.json)" - - variantArches= - case "$v" in - windows/*) variantArches='windows-amd64' ;; - *) - # see "update.sh" for where these comment lines get embedded - parent="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")" - parentArches="${parentRepoToArches[$parent]:-}" - variantArches="$( - comm -12 \ - <( - jq -r ' - .[env.version] - | if env.variant | startswith("alpine") then .alpine else . end - | .[env.javaType].arches - | keys[] - ' versions.json | sort - ) \ - <(xargs -n1 <<<"$parentArches" | sort) - )" - ;; - esac - - sharedTags=() - for windowsShared in windowsservercore nanoserver; do - if [[ "$variant" == "$windowsShared"* ]]; then - sharedTags+=( $(aliases "$version" "$javaType" "$fullVersion" "$windowsShared") ) - break - fi - done - if _latest "$version" "$variant"; then - sharedTags+=( $(aliases "$version" "$javaType" "$fullVersion" 'latest') ) - fi - - variantAliases=( "$variant" ) - case "$variant" in - "$defaultOracleVariant") variantAliases+=( oracle ) ;; - "slim-$defaultDebianVariant") variantAliases+=( slim ) ;; - "$defaultAlpineVariant") variantAliases+=( alpine ) ;; - esac - - constraints= - case "$v" in - windows/*) - constraints="$variant" - if [[ "$variant" == nanoserver-* ]]; then - # nanoserver variants "COPY --from=...:...-windowsservercore-... ..." - constraints+=", windowsservercore-${variant#nanoserver-}" - fi - ;; - esac - - echo - echo "Tags: $(join ', ' $(aliases "$version" "$javaType" "$fullVersion" "${variantAliases[@]}"))" - if [ "${#sharedTags[@]}" -gt 0 ]; then - echo "SharedTags: $(join ', ' "${sharedTags[@]}")" - fi - cat <<-EOE - Architectures: $(join ', ' $variantArches) - GitCommit: $commit - Directory: $dir - EOE - [ -z "$constraints" ] || echo "Constraints: $constraints" - done - done -done +exec jq \ + --raw-output \ + --from-file generate-stackbrew-library.jq \ + versions.json \ + --args -- "$@" diff --git a/versions.json b/versions.json index f58e39e8..9287c89e 100644 --- a/versions.json +++ b/versions.json @@ -1,19 +1,18 @@ { "26": { - "jdk": { - "arches": { - "amd64": { - "sha256": "b87eeeb2167b024e3e62fb5ab860c0e2ad004d2e04f716b9f885d1180ac97a03", - "url": "https://download.java.net/java/early_access/jdk26/22/GPL/openjdk-26-ea+22_linux-x64_bin.tar.gz" - }, - "arm64v8": { - "sha256": "b401cd0d932a4b8fd19f44deb517bfe9441097f31a2bbdb247e3b8757772e147", - "url": "https://download.java.net/java/early_access/jdk26/22/GPL/openjdk-26-ea+22_linux-aarch64_bin.tar.gz" - }, - "windows-amd64": { - "sha256": "8d5e7c08f721a437ebd1097300a807cf2574e5a2fece94320b0202fc8703ba8f", - "url": "https://download.java.net/java/early_access/jdk26/22/GPL/openjdk-26-ea+22_windows-x64_bin.zip" - } + "version": "26-ea+22", + "arches": { + "amd64": { + "url": "https://download.java.net/java/early_access/jdk26/22/GPL/openjdk-26-ea+22_linux-x64_bin.tar.gz", + "sha256": "b87eeeb2167b024e3e62fb5ab860c0e2ad004d2e04f716b9f885d1180ac97a03" + }, + "arm64v8": { + "url": "https://download.java.net/java/early_access/jdk26/22/GPL/openjdk-26-ea+22_linux-aarch64_bin.tar.gz", + "sha256": "b401cd0d932a4b8fd19f44deb517bfe9441097f31a2bbdb247e3b8757772e147" + }, + "windows-amd64": { + "url": "https://download.java.net/java/early_access/jdk26/22/GPL/openjdk-26-ea+22_windows-x64_bin.zip", + "sha256": "8d5e7c08f721a437ebd1097300a807cf2574e5a2fece94320b0202fc8703ba8f" } }, "variants": [ @@ -27,7 +26,6 @@ "windows/windowsservercore-ltsc2022", "windows/nanoserver-ltsc2025", "windows/nanoserver-ltsc2022" - ], - "version": "26-ea+22" + ] } } diff --git a/versions.sh b/versions.sh index 921282f5..5d29ecd8 100755 --- a/versions.sh +++ b/versions.sh @@ -96,9 +96,8 @@ for version in "${versions[@]}"; do doc='{}' possibleArches=( # https://jdk.java.net/26/ - 'linux-aarch64' 'linux-x64' - 'linux-x64-musl' + 'linux-aarch64' 'windows-x64' ) for arch in "${possibleArches[@]}"; do @@ -108,22 +107,18 @@ for version in "${versions[@]}"; do windows-*) downloadSuffix+='.zip'; bashbrewArch='windows-' ;; *) echo >&2 "error: unknown Oracle arch: '$arch'"; exit 1 ;; esac - jqExprPrefix= - if [[ "$arch" == *-musl ]]; then - jqExprPrefix='.alpine' - fi if downloadUrl="$(jdk-java-net-download-url "$version" "$downloadSuffix")" \ && [ -n "$downloadUrl" ] \ && downloadSha256="$(_get "$downloadUrl.sha256")" \ && [ -n "$downloadSha256" ] \ ; then downloadVersion="$(jdk-java-net-download-version "$version" "$downloadUrl")" - currentVersion="$(jq <<<"$doc" -r "$jqExprPrefix.version // \"\"")" + currentVersion="$(jq <<<"$doc" -r '.version // ""')" if [ -n "$currentVersion" ] && [ "$currentVersion" != "$downloadVersion" ]; then echo >&2 "error: Oracle version mismatch: '$currentVersion' vs '$downloadVersion'" exit 1 elif [ -z "$currentVersion" ]; then - echo "$version: $downloadVersion${jqExprPrefix:+ (alpine)}" + echo "$version: $downloadVersion" fi case "$arch" in *-aarch64*) bashbrewArch+='arm64v8' ;; @@ -132,8 +127,8 @@ for version in "${versions[@]}"; do esac export arch bashbrewArch downloadUrl downloadSha256 downloadVersion doc="$(jq <<<"$doc" -c ' - '"$jqExprPrefix"'.version = env.downloadVersion - | '"$jqExprPrefix"'.jdk.arches[env.bashbrewArch] = { + .version = env.downloadVersion + | .arches[env.bashbrewArch] = { url: env.downloadUrl, sha256: env.downloadSha256, } @@ -159,12 +154,7 @@ for version in "${versions[@]}"; do "bookworm", empty | ., "slim-" + .), - if $doc.alpine then - "3.22", - "3.21", - empty - | "alpine" + . else empty end, - if $doc.jdk.arches | keys | any(startswith("windows-")) then + if $doc.arches | keys | any(startswith("windows-")) then ( "ltsc2025", "ltsc2022", @@ -181,4 +171,4 @@ for version in "${versions[@]}"; do ')" done -jq <<<"$json" -S . > versions.json +jq <<<"$json" . > versions.json