Hi, I am trying loop through array values using each and wants to run 2 set of operation but when I add it it throws some closure issue (I m pretty new to groovy, didn’t get what it meant by). Here is the sample code which I am trying. Commented two lines are the one which I want to execute before creating pipelineJob. Can anyone help with the syntax? Or anyother method to loop array values and create pipeline job and other script execution. Please help.
create_job.groovy ================= def apps = [ [project:"myproj",repo:"my-test-repo1"], [project:"testproj",repo:"my-test-repo2"], [project:"myproj",repo:"my-dev-repo"] ] apps.each { app -> //mystashurl = '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