diff --git a/Jenkinsfile b/Jenkinsfile index 79ca1e9e06..3a53e770d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,16 +47,21 @@ stage('Build') { withEnv(envVars) { echo '= bake target: linux' - def windowsImageTypes = ['windowsservercore-ltsc2022'] + def windowsImageTypes = ['windowsservercore-ltsc2022', 'windowsservercore-ltsc2025'] for (anImageType in windowsImageTypes) { def imageType = anImageType builds[imageType] = { - nodeWithTimeout('windows-2022') { + nodeWithTimeout('windows-2025') { stage('Checkout') { checkout scm } withEnv(["IMAGE_TYPE=${imageType}"]) { + stage('Prepare Docker') { + infra.withDockerCredentials { + powershell './make.ps1 -Target docker-init' + } + } if (!infra.isTrusted()) { /* Outside of the trusted.ci environment, we're building and testing * the Dockerfile in this repository, but not publishing to docker hub @@ -119,14 +124,14 @@ stage('Build') { // This list can be updated with the following command: // make show | jq -r '.target | keys[]' | sort def images = [ - 'alpine_jdk21', - 'alpine_jdk25', - 'debian_jdk21', - 'debian_jdk25', - 'debian-slim_jdk21', - 'debian-slim_jdk25', - 'rhel_jdk21', - 'rhel_jdk25', + // 'alpine_jdk21', + // 'alpine_jdk25', + // 'debian_jdk21', + // 'debian_jdk25', + // 'debian-slim_jdk21', + // 'debian-slim_jdk25', + // 'rhel_jdk21', + // 'rhel_jdk25', ] for (i in images) { def imageToBuild = i @@ -167,23 +172,23 @@ stage('Build') { } } } - // Building every other architectures than amd64 on agents with the corresponding labels if available - architecturesAndCiJioAgentLabels.findAll { arch, _ -> arch != 'amd64' }.each { architecture, labels -> - builds[architecture] = { - nodeWithTimeout(labels) { - stage('Checkout') { - deleteDir() - checkout scm - } - // sanity check that proves all images build on declared platforms not already built in other stages - stage("Multi arch build - ${architecture}") { - infra.withDockerCredentials { - sh "make docker-init listarch-${architecture} buildarch-${architecture}" - } - } - } - } - } + // // Building every other architectures than amd64 on agents with the corresponding labels if available + // architecturesAndCiJioAgentLabels.findAll { arch, _ -> arch != 'amd64' }.each { architecture, labels -> + // builds[architecture] = { + // nodeWithTimeout(labels) { + // stage('Checkout') { + // deleteDir() + // checkout scm + // } + // // sanity check that proves all images build on declared platforms not already built in other stages + // stage("Multi arch build - ${architecture}") { + // infra.withDockerCredentials { + // sh "make docker-init listarch-${architecture} buildarch-${architecture}" + // } + // } + // } + // } + // } } else { // Only publish when a tag triggered the build if (env.TAG_NAME) { diff --git a/make.ps1 b/make.ps1 index 81620eabc8..2896f63c7a 100644 --- a/make.ps1 +++ b/make.ps1 @@ -62,6 +62,30 @@ $env:COMMIT_SHA=$(git rev-parse HEAD) $baseDockerCmd = 'docker-compose --file=build-windows.yaml' $baseDockerBuildCmd = '{0} build --parallel --pull' -f $baseDockerCmd +function Initialize-Docker() { + # Cf https://github.com/jenkins-infra/jenkins-infra/blob/production/modules/profile/templates/jenkinscontroller/casc/clouds-ec2.yaml.erb + $dockerDaemonConfigPath = 'C:\ProgramData\Docker\config\daemon.json' + if (Test-Path $dockerDaemonConfigPath) { + $dockerDaemonConfig = Get-Content -Path $dockerDaemonConfigPath -Raw | ConvertFrom-Json + Write-Host "${dockerDaemonConfigPath} file content:" + $dockerDaemonConfig | ConvertTo-Json + # Remove docker daemon config setting "data-root" to Z:\docker (NVMe mount) to avoid hitting moby/moby#48093 + Remove-Item -Path $dockerDaemonConfigPath + Restart-Service docker + } + Get-ComputerInfo | Select-Object OsName, OsBuildNumber, WindowsVersion + Get-WindowsFeature Containers | Out-String + Invoke-Expression 'docker info' + Get-CimInstance -ClassName Win32_Processor + Get-ChildItem env: | Select-Object Name, Value +} + +if($target -eq 'docker-init') { + Write-Host '= Initialize-Docker then exit' + Initialize-Docker + exit 0 +} + Write-Host "= PREPARE: List of $Organisation/$Repository images and tags to be processed:" Invoke-Expression "$baseDockerCmd config"