(projectName, pipelineName) = GetRunningPipelineName(env.JOB_NAME) // env.JOB_NAME is the name of the job given by Jenkins
env.REPOSITORY_NAME = repositoryName
env.PIPELINE_NAME = pipelineName
(projectName, pipelineName) = GetRunningPipelineName(env.JOB_NAME) // env.JOB_NAME is the name of the job given by Jenkins
if(env.BRANCH_NAME) {
env.PIPELINE_NAME = pipelineName
branchName = env.BRANCH_NAME
if(env.BRANCH_NAME) {
} else {
branchName = env.BRANCH_NAME
branchName = scm.branches[0].name // for non-multibranch pipelines
env.BRANCH_NAME = branchName // so scripts that read this environment have it (e.g. incremental_build_util.py)
}
if(env.CHANGE_TARGET) {
// PR builds
if(BUILD_SNAPSHOTS.contains(env.CHANGE_TARGET)) {
snapshot = env.CHANGE_TARGET
echo "Snapshot for destination branch \"${env.CHANGE_TARGET}\" found."
} else {
} else {
snapshot = DEFAULT_BUILD_SNAPSHOT
branchName = scm.branches[0].name // for non-multibranch pipelines
echo "Snapshot for destination branch \"${env.CHANGE_TARGET}\" does not exist, defaulting to snapshot \"${snapshot}\""
env.BRANCH_NAME = branchName // so scripts that read this environment have it (e.g. incremental_build_util.py)
}
}
} else {
if(env.CHANGE_TARGET) {
// Non-PR builds
// PR builds
pipelineParameters.add(choice(defaultValue: DEFAULT_BUILD_SNAPSHOT, name: 'SNAPSHOT', choices: BUILD_SNAPSHOTS_WITH_EMPTY, description: 'Selects the build snapshot to use. A more diverted snapshot will cause longer build times, but will not cause build failures.'))
if(BUILD_SNAPSHOTS.contains(env.CHANGE_TARGET)) {
snapshot = env.SNAPSHOT
snapshot = env.CHANGE_TARGET
echo "Snapshot \"${snapshot}\" selected."
echo "Snapshot for destination branch \"${env.CHANGE_TARGET}\" found."
}
} else {
pipelineProperties.add(disableConcurrentBuilds())
snapshot = DEFAULT_BUILD_SNAPSHOT
echo "Snapshot for destination branch \"${env.CHANGE_TARGET}\" does not exist, defaulting to snapshot \"${snapshot}\""
}
} else {
// Non-PR builds
pipelineParameters.add(choice(defaultValue: DEFAULT_BUILD_SNAPSHOT, name: 'SNAPSHOT', choices: BUILD_SNAPSHOTS_WITH_EMPTY, description: 'Selects the build snapshot to use. A more diverted snapshot will cause longer build times, but will not cause build failures.'))
// Add each platform as a parameter that the user can disable if needed
// Add each platform as a parameter that the user can disable if needed
if (!IsPullRequest(branchName)) {
if (!IsPullRequest(branchName)) {
pipelineParameters.add(stringParam(defaultValue: '', description: 'Filters and overrides the list of jobs to run for each of the below platforms (comma-separated). Can\'t be used during a pull request.', name: 'JOB_LIST_OVERRIDE'))
pipelineParameters.add(stringParam(defaultValue: '', description: 'Filters and overrides the list of jobs to run for each of the below platforms (comma-separated). Can\'t be used during a pull request.', name: 'JOB_LIST_OVERRIDE'))