Skip to content

Commit e3b6d01

Browse files
committed
wip
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
1 parent f43ed64 commit e3b6d01

6 files changed

Lines changed: 36 additions & 23 deletions

File tree

.ci/publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ $(printf ' %s\n' "${build_opts[@]}")
107107
EOF
108108

109109
echo '* RESOLVED BAKE CONFIG:'
110-
docker buildx bake --file docker-bake.hcl --progress=quiet --print "${BAKE_TARGET}"
110+
docker buildx bake --file docker-bake.hcl --file docker-bake.override.json --file docker-bake.override.json --progress=quiet --print "${BAKE_TARGET}"
111111

112112
if [[ "${CI:-false}" == "false" ]]; then
113113
read -rp "Confirm? [y/N] " answer

docker-bake.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ target "windowsservercore" {
171171
WAR_URL = war_url()
172172
COMMIT_SHA = COMMIT_SHA
173173
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
174-
JAVA_VERSION = javaversion(jdk)
174+
JAVA_ZIP_URL = lookup(jdk_installer_urls["windows"]["amd64"], jdk, "Installer URL not found")
175175
JAVA_HOME = "C:/openjdk-${jdk}"
176176
WINDOWS_VERSION = windows_version
177177
}

docker-bake.override.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"variable": {
3+
"jdk_installer_urls": {
4+
"default": {
5+
"windows": {
6+
"amd64": {
7+
"17": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.19%2B10/OpenJDK17U-jdk_x64_windows_hotspot_17.0.19_10.zip",
8+
"21": "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_windows_hotspot_21.0.11_10.zip",
9+
"25": "https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_windows_hotspot_25.0.3_9.zip"
10+
}
11+
}
12+
}
13+
}
14+
}
15+
}

make.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function Initialize-DockerComposeFile {
188188
# - Use docker buildx bake to output image definitions from the "<windowsFlavor>" bake target
189189
# - Convert with yq to the format expected by docker compose
190190
# - Store the result in the docker compose file
191-
docker buildx bake --progress=quiet --file=docker-bake.hcl $windowsFlavor --print |
191+
docker buildx bake --progress=quiet --file=docker-bake.hcl --file docker-bake.override.json $windowsFlavor --print |
192192
yq --prettyPrint $yqMainQuery |
193193
yq $yqServicesQuery |
194194
Out-File -FilePath $DockerComposeFile
@@ -208,7 +208,7 @@ yq --version
208208
# Add 'lts-' prefix to LTS tags not including Jenkins version
209209
# Compared to weekly releases, LTS releases include an additional build number in their version
210210
$releaseLine = 'war'
211-
# Determine if the current JENKINS_VERSION corresponds to the latest Weekly or LTS version from Artifactory
211+
# Determine if the current JENKINS_VERSION corresponds to the latest Weekly or LTS version from Artifactory
212212
$isJenkinsVersionLatest = Test-IsLatestJenkinsRelease -Version $JenkinsVersion
213213

214214
if ($JenkinsVersion.Split('.').Count -eq 3) {

updatecli/updatecli.d/jdk21.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ targets:
6161
- alpine/hotspot/Dockerfile
6262
- debian/Dockerfile
6363
- rhel/Dockerfile
64-
- windows/windowsservercore/hotspot/Dockerfile
6564
instruction:
6665
keyword: ARG
6766
matcher: JAVA_VERSION

windows/windowsservercore/hotspot/Dockerfile

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
# escape=`
22
# hadolint shell=powershell
33

4-
ARG JAVA_VERSION=21.0.11_10
54
ARG WINDOWS_VERSION=ltsc2022
65

76
FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION}" AS jre-and-war
87

98
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
109
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
1110

12-
ARG JAVA_VERSION=21.0.11_10
13-
14-
RUN New-Item -ItemType Directory -Path C:\temp | Out-Null ; `
15-
$javaMajorVersion = $env:JAVA_VERSION.substring(0,2) ; `
16-
$msiUrl = 'https://api.adoptium.net/v3/installer/version/jdk-{0}/windows/x64/jdk/hotspot/normal/eclipse?project=jdk' -f $env:JAVA_VERSION.Replace('_', '%2B') ; `
17-
Invoke-WebRequest $msiUrl -OutFile 'C:\temp\jdk.msi' ; `
18-
$proc = Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i', 'C:\temp\jdk.msi', '/L*V', 'C:\temp\OpenJDK.log', '/quiet', 'ADDLOCAL=FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome', "INSTALLDIR=C:\openjdk-${javaMajorVersion}" -Wait -Passthru ; `
19-
$proc.WaitForExit() ; `
20-
Remove-Item -Path C:\temp -Recurse | Out-Null
21-
22-
RUN Write-Host 'javac --version' ; javac --version ; `
23-
Write-Host 'java --version' ; java --version
24-
25-
RUN $version = (jlink --version) ; `
11+
ARG JAVA_ZIP_URL="Provided by docker-bake.hcl"
12+
ARG jdkTempHome='C:\openjdk'
13+
ARG jdkTemp='C:\jdktemp'
14+
ARG localArchive="${jdkTemp}\jdk.zip"
15+
RUN New-Item -ItemType Directory -Path $env:jdkTemp | Out-Null ; `
16+
Invoke-WebRequest $env:JAVA_ZIP_URL -OutFile $env:localArchive ; `
17+
Expand-Archive -Path $env:localArchive -DestinationPath $env:jdkTemp ; `
18+
$expandedDir = Get-ChildItem -Path $env:jdkTemp -Directory | Where-Object { $_.Name -like 'jdk*' } ; `
19+
Move-Item -Path $expandedDir.FullName -Destination $env:jdkTempHome -Force ; `
20+
Remove-Item -Path $env:jdkTemp -Recurse | Out-Null
21+
22+
RUN Write-Host 'javac --version' ; $env:jdkTempHome/javac --version ; `
23+
Write-Host 'java --version' ; $env:jdkTempHome/java --version
24+
25+
RUN $version = ($env:jdkTempHome/jlink --version) ; `
2626
$javaMajorVersion = $version.Substring(0,2) ; `
2727
if ($javaMajorVersion -eq '25') { `
28-
$openjdkFolder = 'openjdk-{0}' -f $javaMajorVersion ; `
29-
Copy-Item -Path $openjdkFolder -Destination C:\javaruntime -Recurse ; `
28+
Move-Item -Path $$env:jdkTempHome -Destination C:\javaruntime -Recurse ; `
3029
} else { `
3130
$options = '--compress=2' ; `
3231
switch ($version.Substring(0,3)) { `
@@ -36,7 +35,7 @@ RUN $version = (jlink --version) ; `
3635
exit 1 ; `
3736
} `
3837
} `
39-
& jlink `
38+
& $env:jdkTempHome/jlink `
4039
--strip-java-debug-attributes `
4140
$options `
4241
--add-modules ALL-MODULE-PATH `

0 commit comments

Comments
 (0)