szabieable
szabieable

Reputation: 123

Jenkins pipeline node variables

I would like to access a direct node env variable in jenkins job description, like this:

node("${DEST_NODE}") {
   stage("server info")
   {
      sh 'PYT=$(python --version)'
      currentBuild.description = "Python: " + System.getenv("PYT")
      currentBuild.description = "Python: " + ${PYT}
   }
}

What is the right way to access a shell variable from pipeline?

Upvotes: 1

Views: 1279

Answers (1)

szabieable
szabieable

Reputation: 123

Found a solution for it:

currentBuild.description = sh(returnStdout: true, script: 'python --version')

Upvotes: 1

Related Questions