Обновить pipelines/gitea-events/jobs-runner.groovy (!47)

add condition by branch

Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/47
This commit is contained in:
Rustam Tagaev
2024-11-12 18:32:54 +03:00
parent 8152b6728e
commit 4ed0e6f48a

View File

@@ -62,19 +62,19 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"), yaml: g
String branch = getBranch(fullJSON) String branch = getBranch(fullJSON)
currentBuild.description = "Repo: ${fullJSON.repository.full_name} $branch" currentBuild.description = "Repo: ${fullJSON.repository.full_name} $branch"
// Check project in map and start to work with it
projects[projectName].each { Map project -> projects[projectName].each { Map project ->
currentBuild.displayName = "#${env.BUILD_ID} Run for all branches" if (project.branches.contains(branch) || project.branches == []) {
currentBuild.displayName = "#${env.BUILD_ID} Run on ${branch}"
project.jobs.each { Map job -> project.jobs.each { Map job ->
build job: job.job, build job: job.job,
parameters: [ parameters: [
string(name: 'PROJECT_NAME', value: projectName), string(name: 'PROJECT_NAME', value: projectName),
string(name: 'BRANCH_NAME', value: branch), string(name: 'BRANCH_NAME', value: branch),
string(name: 'DATA_JSON', value: fullJSON.toString()) string(name: 'DATA_JSON', value: fullJSON.toString())
], ],
wait: false wait: false
}
} }
} }
} }