Pass meta to post action handlers; Pass release repo to post actions

This commit is contained in:
Dan Hawkins 2022-03-14 15:00:37 +00:00
commit d21f4b1a7e

View file

@ -85,16 +85,20 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam
return jobname
}
def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) {
def deployjob(meta, String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername, String releaserepoparametername = '') {
def jobname = getActionJobName(postbuildactions, action, alternativeparamname)
if (jobname) {
def parameters = [
StringParameterValue(jobnameparametername, JOB_NAME),
StringParameterValue(jobselectorparametername, buildselector),
]
if (releaserepoparametername) {
parameters += StringParameterValue(releaserepoparametername, meta.releaseinfo.releaserepoURL)
}
build(
wait: false,
job: jobname,
parameters: [
string(name: jobnameparametername, value: JOB_NAME),
string(name: jobselectorparametername, value: buildselector),
]
parameters: parameters
)
}
}
@ -107,7 +111,7 @@ def readPostBuildInfo() {
return postbuildinfo
}
def performSuccessfulBuildActions() {
def performSuccessfulBuildActions(meta) {
def postbuildactions
if (params.POST_BUILD_INFO != null) {
def postbuildinfo = readPostBuildInfo()
@ -119,12 +123,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', '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_TO_TEST_SELECTOR')
deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_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')
deployjob(meta, buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR')
deployjob(meta, buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' )
deployjob(meta, buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR')
deployjob(meta, buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR')
deployjob(meta, buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR', 'TOP_LEVEL_META_REPOSITORY')
deployjob(meta, buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR')
}
def sendemails(emailinfo) {
@ -201,7 +205,7 @@ def sendextemail(extmailinfo) {
)
}
def performFailedBuildActions() {
def performFailedBuildActions(meta) {
def postbuildactions = null
if (params.POST_BUILD_INFO != null) {
def postbuildinfo = readPostBuildInfo()