forked from adoptium/ci-jenkins-pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline_job_template.groovy
178 lines (167 loc) · 12.1 KB
/
pipeline_job_template.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import groovy.json.JsonOutput
gitRefSpec = ''
propagateFailures = true
runReproducibleCompare = enableReproducibleCompare
runTests = enableTests
runParallel = enableTestDynamicParallel
runInstaller = true
runSigner = true
cleanWsBuildOutput = true
jdkVersion = "${JAVA_VERSION}"
isLightweight = true
jobReleaseType = "${releaseType}"
pipelineSchedule = pipelineSchedule
// if true means this is running in the pr builder pipeline
if (binding.hasVariable('PR_BUILDER')) {
pipelineSchedule = '0 0 31 2 0' // 31st Feb, so will never run
gitRefSpec = '+refs/pull/*:refs/remotes/origin/pr/* +refs/heads/master:refs/remotes/origin/master +refs/heads/*:refs/remotes/origin/*'
propagateFailures = true
runTests = false
runParallel = true
runSigner = false
runInstaller = false
isLightweight = false
}
if (!binding.hasVariable('disableJob')) {
disableJob = false
}
folder("${BUILD_FOLDER}")
folder("${BUILD_FOLDER}/jobs")
pipelineJob("${BUILD_FOLDER}/${JOB_NAME}") {
description('<h1>THIS IS AN AUTOMATICALLY GENERATED JOB DO NOT MODIFY, IT WILL BE OVERWRITTEN.</h1><p>This job is defined in pipeline_job_template.groovy in the ci-jenkins-pipelines repo, if you wish to change it modify that.</p>')
definition {
cpsScm {
scm {
git {
remote {
url("${GIT_URL}")
refspec(gitRefSpec)
credentials("${CHECKOUT_CREDENTIALS}")
}
branch("${BRANCH}")
}
}
scriptPath(SCRIPT)
lightweight(isLightweight)
}
}
disabled(disableJob)
logRotator {
numToKeep(60)
artifactNumToKeep(2)
}
properties {
// Hide top level pipeline access from the public as they contain non Temurin artefacts
if (JENKINS_URL.contains('adopt')) {
authorizationMatrix {
inheritanceStrategy {
// Do not inherit permissions from global configuration
nonInheriting()
}
entries {
group {
name('AdoptOpenJDK*build')
permissions(
[
'Job/Build', // 'hudson.model.Item.Build'
'Job/Cancel', // 'hudson.model.Item.Cancel'
'Job/Configure', // 'hudson.model.Item.Configure'
'Job/Read', // 'hudson.model.Item.Read'
'Job/Workspace', // 'hudson.model.Item.Workspace'
'Run/Update' // 'hudson.model.Run.Update'
])
}
group {
name('AdoptOpenJDK*build-triage')
permissions(
[
'Job/Build', // 'hudson.model.Item.Build'
'Job/Cancel', // 'hudson.model.Item.Cancel'
'Job/Configure', // 'hudson.model.Item.Configure'
'Job/Read', // 'hudson.model.Item.Read'
'Job/Workspace', // 'hudson.model.Item.Workspace'
'Run/Update' // 'hudson.model.Run.Update'
])
}
// eclipse-temurin-bot needs read access for TRSS
user {
name('eclipse-temurin-bot')
permissions(
[
'Job/Read' // 'hudson.model.Item.Read'
])
}
// eclipse-temurin-compliance bot needs read access for https://ci.eclipse.org/temurin-compliance for copying artifacts
user {
name('eclipse-temurin-compliance-bot')
permissions(
[
'Job/Read' // 'hudson.model.Item.Read'
])
}
}
//permissions([
//'GROUP:hudson.model.Item.Build:AdoptOpenJDK*build', MIGRATED
//'GROUP:hudson.model.Item.Build:AdoptOpenJDK*build-triage', MIGRATED
//'GROUP:hudson.model.Item.Cancel:AdoptOpenJDK*build', MIGRATED
//'GROUP:hudson.model.Item.Cancel:AdoptOpenJDK*build-triage', MIGRATED
//'GROUP:hudson.model.Item.Configure:AdoptOpenJDK*build', MIGRATED
//'GROUP:hudson.model.Item.Configure:AdoptOpenJDK*build-triage', MIGRATED
//'GROUP:hudson.model.Item.Read:AdoptOpenJDK*build', MIGRATED
//'GROUP:hudson.model.Item.Read:AdoptOpenJDK*build-triage', MIGRATED
// eclipse-temurin-bot needs read access for TRSS
//'USER:hudson.model.Item.Read:eclipse-temurin-bot', MIGRATED
// eclipse-temurin-compliance bot needs read access for https://ci.eclipse.org/temurin-compliance
//'USER:hudson.model.Item.Read:eclipse-temurin-compliance-bot', MIGRATED
//'GROUP:hudson.model.Item.Workspace:AdoptOpenJDK*build', MIGRATED
//'GROUP:hudson.model.Item.Workspace:AdoptOpenJDK*build-triage', MIGRATED
//'GROUP:hudson.model.Run.Update:AdoptOpenJDK*build', MIGRATED
//'GROUP:hudson.model.Run.Update:AdoptOpenJDK*build-triage']) MIGRATED
}
}
pipelineTriggers {
triggers {
cron {
spec(pipelineSchedule)
}
}
}
copyArtifactPermission {
projectNames('*')
}
}
parameters {
textParam('targetConfigurations', JsonOutput.prettyPrint(JsonOutput.toJson(targetConfigurations)))
stringParam('activeNodeTimeout', '5', 'Number of minutes we will wait for a label-matching node to become active.')
stringParam('jdkVersion', jdkVersion, 'The JDK version of the pipeline e.g (8, 11, 17).')
stringParam('dockerExcludes', '', 'Map of targetConfigurations to exclude from docker building. If a targetConfiguration (i.e. { "x64LinuxXL": [ "openj9" ], "aarch64Linux": [ "hotspot", "openj9" ] }) has been entered into this field, jenkins will build the jdk without using docker. This param overrides the dockerImage and dockerFile downstream job parameters.')
stringParam('baseFilePath', '', "Relative path to where the build_base_file.groovy file is located. This runs the downstream job setup and configuration retrieval services.<br>Default: <code>${defaultsJson['baseFileDirectories']['upstream']}</code>")
stringParam('buildConfigFilePath', '', "Relative path to where the jdkxx_pipeline_config.groovy file is located. It contains the build configurations for each platform, architecture and variant.<br>Default: <code>${defaultsJson['configDirectories']['build']}/jdkxx_pipeline_config.groovy</code>")
choiceParam('releaseType', [jobReleaseType, 'Nightly Without Publish', 'Nightly', 'Weekly', 'Weekly Without Publish', 'Release'].unique(), 'Nightly - release a standard nightly build.<br/>Nightly Without Publish - run a nightly but do not publish.<br/>Weekly - release a standard weekly build, run with extended tests.<br/>Weekly Without Publish - run a weekly but do not publish.<br/>Release - this is a release, this will need to be manually promoted.')
stringParam('overridePublishName', '', '<strong>REQUIRED for OpenJ9</strong>: Name that determines the publish name (and is used by the meta-data file), defaults to scmReference(minus _adopt if present).<br/>Nightly builds: Leave blank (defaults to a date_time stamp).<br/>OpenJ9 Release build Java 8 example <code>jdk8u192-b12_openj9-0.12.1</code> and for OpenJ9 Java 11 example <code>jdk-11.0.2+9_openj9-0.12.1</code>.')
stringParam('scmReference', '', 'Tag name or Branch name from which openjdk source code repo to build. Nightly builds: Defaults to, Hotspot=dev, OpenJ9=openj9, others=master.</br>Release builds: For hotspot JDK8 this would be the OpenJDK tag, for hotspot JDK11+ this would be the Adopt merge tag for the desired OpenJDK tag eg.jdk-11.0.4+10_adopt, and for OpenJ9 this will be the release branch, eg.openj9-0.14.0.')
stringParam('buildReference', '', 'SHA1 or Tag name or Branch name of temurin-build repo. Defaults to master')
stringParam('ciReference', '', 'SHA1 or Tag name or Branch name of ci-jenkins-pipeline repo. Defaults to master')
stringParam('helperReference', '', 'Tag name or Branch name of jenkins-helper repo. Defaults to master')
stringParam('aqaReference', '', 'Tag name or Branch name of aqa-tests. Defaults to master')
booleanParam('aqaAutoGen', false, 'If set to true, force auto generate AQA test jobs. Defaults to false')
booleanParam('enableReproducibleCompare', runReproducibleCompare, 'If set to true the reproducible compare job might be triggerred')
booleanParam('enableTests', runTests, 'If set to true the test pipeline will be executed')
booleanParam('enableTestDynamicParallel', runParallel, 'If set to true test will be run parallel')
booleanParam('enableInstallers', runInstaller, 'If set to true the installer pipeline will be executed')
booleanParam('enableSigner', runSigner, 'If set to true the signer pipeline will be executed')
stringParam('additionalConfigureArgs', '', "Additional arguments that will be ultimately passed to OpenJDK's <code>./configure</code>")
stringParam('additionalBuildArgs', '', 'Additional arguments to be passed to <code>makejdk-any-platform.sh</code>')
stringParam('overrideFileNameVersion', '', "When forming the filename, ignore the part of the filename derived from the publishName or timestamp and override it.<br/>For instance if you set this to 'FOO' the final file name will be of the form: <code>OpenJDK8U-jre_ppc64le_linux_openj9_FOO.tar.gz</code>")
booleanParam('useAdoptBashScripts', adoptScripts, "If enabled, the downstream job will pull and execute <code>make-adopt-build-farm.sh</code> from adoptium/temurin-build. If disabled, it will use whatever the job is running inside of at the time, usually it's the default repository in the configuration.")
booleanParam('cleanWorkspaceBeforeBuild', false, 'Clean out the workspace before the build')
booleanParam('cleanWorkspaceAfterBuild', false, 'Clean out the workspace after the build')
booleanParam('cleanWorkspaceBuildOutputAfterBuild', cleanWsBuildOutput, 'Clean out the workspace/build/src/build and workspace/target output only, after the build')
booleanParam('propagateFailures', propagateFailures, 'If true, a failure of <b>ANY</b> downstream build will cause the whole build to fail')
booleanParam('keepTestReportDir', false, 'If true, test report dir (including core files where generated) will be kept even when the testcase passes, failed testcases always keep the report dir. Does not apply to JUnit jobs which are always kept, eg.openjdk.')
booleanParam('keepReleaseLogs', true, 'If true, "Release" type pipeline Jenkins logs will be marked as "Keep this build forever".')
stringParam('adoptBuildNumber', '', 'Empty by default. If you ever need to re-release then bump this number. Currently this is only added to the build metadata file.')
textParam('defaultsJson', JsonOutput.prettyPrint(JsonOutput.toJson(defaultsJson)), '<strong>DO NOT ALTER THIS PARAM UNLESS YOU KNOW WHAT YOU ARE DOING!</strong> This passes down the user\'s default constants to the downstream jobs.')
textParam('adoptDefaultsJson', JsonOutput.prettyPrint(JsonOutput.toJson(adoptDefaultsJson)), '<strong>DO NOT ALTER THIS PARAM UNDER ANY CIRCUMSTANCES!</strong> This passes down adoptium\'s default constants to the downstream jobs. NOTE: <code>defaultsJson</code> has priority, the constants contained within this param will only be used as a failsafe.')
}
}