|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright IBM Corp. and others 2025 |
| 3 | + * |
| 4 | + * This program and the accompanying materials are made available under |
| 5 | + * the terms of the Eclipse Public License 2.0 which accompanies this |
| 6 | + * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ |
| 7 | + * or the Apache License, Version 2.0 which accompanies this distribution and |
| 8 | + * is available at https://www.apache.org/licenses/LICENSE-2.0. |
| 9 | + * |
| 10 | + * This Source Code may also be made available under the following |
| 11 | + * Secondary Licenses when the conditions for such availability set |
| 12 | + * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU |
| 13 | + * General Public License, version 2 with the GNU Classpath |
| 14 | + * Exception [1] and GNU General Public License, version 2 with the |
| 15 | + * OpenJDK Assembly Exception [2]. |
| 16 | + * |
| 17 | + * [1] https://www.gnu.org/software/classpath/license.html |
| 18 | + * [2] https://openjdk.org/legal/assembly-exception.html |
| 19 | + * |
| 20 | + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 |
| 21 | + *******************************************************************************/ |
| 22 | + |
| 23 | +// Remove all bootjdks from build machines. |
| 24 | +// Trigger initially setup for every 6 months. |
| 25 | +// Fire downstream job "all-nodes-matching-labels" with various params in parallel. |
| 26 | + |
| 27 | + def defaultLocation = '$HOME/bootjdks' |
| 28 | + def slackChannel = params.SLACK_CHANNEL ?: '#jenkins-sandbox' |
| 29 | + |
| 30 | +// Do not run on z/OS. |
| 31 | +def GROUPS = [[name:"Mac", labels:"ci.role.build&&sw.os.mac", location:defaultLocation], |
| 32 | + [name:"Windows", labels:"ci.role.build&&sw.os.windows", location:defaultLocation], |
| 33 | + [name:"AIX", labels:"ci.role.build&&sw.os.aix", location:"/opt/bootjdks"], |
| 34 | + [name:"xlinux", labels:"ci.role.build&&sw.os.linux&&hw.arch.x86", location:defaultLocation], |
| 35 | + [name:"plinux", labels:"ci.role.build&&sw.os.linux&&hw.arch.ppc64le", location:defaultLocation], |
| 36 | + [name:"zlinux", labels:"ci.role.build&&sw.os.linux&&hw.arch.s390x", location:defaultLocation], |
| 37 | + [name:"alinux", labels:"ci.role.build&&sw.os.linux&&hw.arch.aarch64", location:defaultLocation] |
| 38 | +] |
| 39 | + |
| 40 | +branches = [:] |
| 41 | +for (i in GROUPS) { |
| 42 | + // def local variable for each loop to avoid all iterations using the last value of 'i'. |
| 43 | + def group = i |
| 44 | + branches["${group.name}"] = { |
| 45 | + build job: 'all-nodes-matching-labels', |
| 46 | + parameters: [ |
| 47 | + string(name: 'LABEL', value: group.labels), |
| 48 | + string(name: 'COMMAND', value: "rm -rf ${group.location}/*"), |
| 49 | + string(name: 'TIMEOUT_TIME', value: '12'), |
| 50 | + booleanParam(name: 'PARALLEL', value: true), |
| 51 | + booleanParam(name: 'CLEANUP', value: false) |
| 52 | + ] |
| 53 | + } |
| 54 | +} |
| 55 | +try { |
| 56 | + parallel branches |
| 57 | +} catch(e) { |
| 58 | + slackSend channel: slackChannel, color: 'danger', message: "Failed: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)" |
| 59 | + throw e |
| 60 | +} |
0 commit comments