I am having a list of variable like below

allModules = ['module1', 'module2', 'module3', 'module4', 'module11']

I want to use loop then print all the module one by one.

Please let me know the syntax and how to perform this in Jenkins Declarative pipeline

1 Answer 1


Pure declarative pipelines don't support loops. Use a script step. There's actually an example on that page that does exactly what you want.

A more readable and concise (IMO) solution would use iterators, like so:

steps {
   script {
      allModules.each() {
         echo it

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .