@@ -14,6 +14,15 @@ properties(listOfProperties)
1414// Default environment variable set to allow images publication
1515def envVars = [' PUBLISH=true' ]
1616
17+ // List of architectures and corresponding ci.jenkins.io agent labels
18+ def architecturesAndCiJioAgentLabels = [
19+ ' amd64' : ' docker && amd64' ,
20+ ' arm64' : ' arm64docker' ,
21+ // No corresponding agent, using qemu
22+ ' ppc64le' : ' docker && amd64' ,
23+ ' s390x' : ' s390xdocker' ,
24+ ]
25+
1726// Set to true in a replay to simulate a LTS build on ci.jenkins.io
1827// It will set the environment variables needed for a LTS
1928// and disable images publication out of caution
@@ -118,7 +127,7 @@ stage('Build') {
118127 def imageToBuild = i
119128
120129 builds[imageToBuild] = {
121- nodeWithTimeout(' docker ' ) {
130+ nodeWithTimeout(architecturesAndCiJioAgentLabels[ " amd64 " ] ) {
122131 deleteDir()
123132
124133 stage(' Checkout' ) {
@@ -153,20 +162,19 @@ stage('Build') {
153162 }
154163 }
155164 }
156- builds[' multiarch-build' ] = {
157- nodeWithTimeout(' docker' ) {
158- stage(' Checkout' ) {
159- deleteDir()
160- checkout scm
161- }
162-
163- // sanity check that proves all images build on declared platforms
164- stage(' Multi arch build' ) {
165- infra. withDockerCredentials {
166- sh '''
167- make docker-init
168- docker buildx bake --file docker-bake.hcl linux
169- '''
165+ // Building every other architectures than amd64 on agents with the corresponding labels if available
166+ architecturesAndCiJioAgentLabels. findAll { arch , _ -> arch != ' amd64' }. each { architecture , labels ->
167+ builds[architecture] = {
168+ nodeWithTimeout(labels) {
169+ stage(' Checkout' ) {
170+ deleteDir()
171+ checkout scm
172+ }
173+ // sanity check that proves all images build on declared platforms not already built in other stages
174+ stage(" Multi arch build - ${ architecture} " ) {
175+ infra. withDockerCredentials {
176+ sh " make docker-init listarch-${ architecture} buildarch-${ architecture} "
177+ }
170178 }
171179 }
172180 }
0 commit comments