Provide specific parameter names appropriate to type of post build job being called

This commit is contained in:
Dan Hawkins 2021-11-30 21:20:31 +00:00
commit 94ba8c77a4

View file

@ -85,26 +85,15 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam
return jobname
}
def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname) {
def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) {
def jobname = getActionJobName(postbuildactions, action, alternativeparamname)
if (jobname) {
build(
wait: false,
job: jobname,
parameters: [
// For most jobs
string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME),
string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector),
// For doxygen jobs
string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME),
string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: buildselector),
// For diff jobs
string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'),
string(name: 'LATER_BUILD_JOB', value: JOB_NAME),
string(name: 'LATER_BUILD_SELECTOR', value: buildselector),
// For regression jobs
string(name: 'BUILD_JOB', value: JOB_NAME),
string(name: 'BUILD_JOB_SELECTOR', value: buildselector),
string(name: jobnameparametername, value: JOB_NAME),
string(name: jobselectorparametername, value: buildselector),
]
)
}
@ -130,12 +119,12 @@ def performSuccessfulBuildActions() {
}
}
def String buildselector = "<SpecificBuildSelector plugin='copyartifact@1.46.2'><buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>"
deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB')
deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB')
deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB')
deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB')
deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB')
deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB')
deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR')
deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' )
deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TEST_SELECTOR')
deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TEST_SELECTOR')
deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR')
deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR')
}
def sendemails(emailinfo) {