i am trying a pipeline job where my first stage job returns a list of values which i should use to make list of parallel jobs in the second stage for each of the value

33 views
Skip to first unread message

amu ch

unread,
Feb 21, 2020, 2:46:00 PM2/21/20
to Jenkins Users
Hi , 

I used this following ; my first part itself is not working where i want to save the return values from my first stage and use them in second stage. 
i tried several methods none worked.   my first stage job just echo " 123 234 345"  ; i tried setting environment variable also setenv versions="123 234 345" echo $versions 

// Powered by Infostretch

env.BAR=123

 

timestamps {

 

node ('mem1') {

 

              stage ('Team/getactivebranch - Build') {

                                          // Shell build step

  def job =  build job: '/Team/getactivebranch/' , parameters: []

     env.BAR=321 

              }

              def checklog2 = job.rawBuild.log

              println (checklog2)

}

}

echo "env.BAR is '${BAR}'"

 

 

 

// Powered by Infostretch

env.BAR=123

 

timestamps {

 

node ('mem1') {

 

              stage ('Teamgetactivebranch - Build') {

                                          // Shell build step

  def job =  build job: '/Team/getactivebranch/' , parameters: []

     env.BAR=321 

              }

             

              println (job.getResult())

}

}

echo "env.BAR is '${BAR}'"

 

 

// Powered by Infostretch

env.BAR=123

 

timestamps {

 

node ('mem1') {

 

              stage ('Team/getactivebranch - Build') {

                                          // Shell build step

  def j1BuildResult =  build job: '/Team/getactivebranch/' , parameters: []

     env.BAR=321 

              }

              def j1EnvVariables = j1BuildResult.getBuildVariables();

              println (j1EnvVariables)

}

}

echo "env.BAR is '${BAR}'"

Ramanathan Muthaiah

unread,
Feb 23, 2020, 10:09:08 PM2/23/20
to Jenkins Users
On Saturday, February 22, 2020 at 1:16:00 AM UTC+5:30, amu ch wrote:
Hi , 

I used this following ; my first part itself is not working where i want to save the return values from my first stage and use them in second stage. 
i tried several methods none worked.   my first stage job just echo " 123 234 345"  ; i tried setting environment variable also setenv versions="123 234 345" echo $versions 



Why not save the return values to a file in the build workspace and use that file in the subsequent stages?

/Ram 
Reply all
Reply to author
Forward
0 new messages