From cb1547669d706e45505f2685e28dce199cb3d5a5 Mon Sep 17 00:00:00 2001 From: dany Date: Thu, 29 Sep 2022 23:18:11 +0200 Subject: [PATCH] Update 'Jenkinsfile' --- Jenkinsfile | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1b63015..c559083 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,16 @@ // need to approve all static functions in Dashboard > Manage Jenkins > ScriptApproval -def parallelStagesMap = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs().collectEntries { - ["${it}" : generateStage(it.getName())] +def ArrayList copyArtifactsByBranches(projectName){ + def jobs = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs(); + Iterator iterator = jobs.iterator(); + def arr = new ArrayList(); + + while (iterator.hasNext()) { + def job = iterator.next(); + arr.add(job.getName()); + } + return arr; } + def generateStage(name) { return { stage("stage: ANTOS ${name}") { @@ -10,18 +19,8 @@ def generateStage(name) { } } -def copyArtifactsByBranches(projectName){ - def jobs = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs(); - Iterator iterator = jobs.iterator(); - while (iterator.hasNext()) { - def job = iterator.next(); - step([$class: 'CopyArtifact', - projectName: 'gitea-sync/antos/' + job.getName(), - target: 'build/frontend/' + job.getName() - ]); - //copyArtifacts(projectName: 'gitea-sync/antos/' + job.getName(), target: 'build/frontend/' + job.getName()); - } - return null; +def parallelStagesMap = jenkins.model.Jenkins.instance.getItemByFullName('gitea-sync/antos').getAllJobs().collectEntries { + ["${it}" : generateStage(it)] } @@ -61,7 +60,7 @@ pipeline{ copyArtifacts(projectName: 'luasec', target: 'build/backend'); script { - parallel(parallelStagesMap); + parallel parallelStagesMap; } //copyArtifacts(projectName: 'gitea-sync/antos/*', target: 'build/frontend'); //copyArtifacts(projectName: 'gitea-sync/antd-web-apps/master', target: 'build/backend');