groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ssubramanian <sakthi.9...@gmail.com>
Subject Need help in each loop to run multiple steps
Date Mon, 02 Oct 2017 04:38:26 GMT
Hi,I am trying loop through array values using each and wants to run 2 set
ofoperation but when I add the steps throws some closure issue (I m pretty
new togroovy, didnot get what it meant by). Here is the sample code which I
amtrying. Commented two lines are the one which I want to execute
beforecreating pipelineJob.  Can anyone help with the syntax? Or anyother
methodto loop array values and create pipeline job and other script
execution.Please help.def apps =3D [  
[project:"myproj",repo:"my-test-repo1"],  
[project:"testproj",repo:"my-test-repo2"],  
[project:"myproj",repo:"my-dev-repo"]]apps.each {       app ->      
//mystashurl =3D 'mybaseurl+scm/'+app.project+'/' + app.repo + '.git='      
//sh("sed -i.bak -e 's#--GIT_URL--#${mystashurl}#' Jenkinsfile")      
pipelineJob('LIB.' + app.repo.replaceAll('-',''))        {        
description('Containerized microservice lib config')         definition {         
cps          {              script(readFileFromWorkspace('Jenkinsfile'))             
sandbox()          }          }        }}Thanks,Sakthi



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
Mime
View raw message