From 4ed0e6f48ab20481896ac65a8380cc723ec8b61f Mon Sep 17 00:00:00 2001 From: Rustam Tagaev Date: Tue, 12 Nov 2024 18:32:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20pipelines/gitea-events/jobs-runner.groovy=20(!47)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add condition by branch Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/47 --- pipelines/gitea-events/jobs-runner.groovy | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pipelines/gitea-events/jobs-runner.groovy b/pipelines/gitea-events/jobs-runner.groovy index 84f1f03..ba7f635 100644 --- a/pipelines/gitea-events/jobs-runner.groovy +++ b/pipelines/gitea-events/jobs-runner.groovy @@ -62,19 +62,19 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"), yaml: g String branch = getBranch(fullJSON) currentBuild.description = "Repo: ${fullJSON.repository.full_name} $branch" - - // Check project in map and start to work with it 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 -> - build job: job.job, - parameters: [ - string(name: 'PROJECT_NAME', value: projectName), - string(name: 'BRANCH_NAME', value: branch), - string(name: 'DATA_JSON', value: fullJSON.toString()) - ], - wait: false + project.jobs.each { Map job -> + build job: job.job, + parameters: [ + string(name: 'PROJECT_NAME', value: projectName), + string(name: 'BRANCH_NAME', value: branch), + string(name: 'DATA_JSON', value: fullJSON.toString()) + ], + wait: false + } } } }