1

In my Jenkinsfile, I'm trying to add a environment variable to a file, however not able to do so - seems like some small syntax thing, however I've tried so many different variations.

So the parameter I want is "${params.Spec}", currently used like:

environment {
        SPECTORUN = "${params.Spec}"
}

Then in my script block i'm trying:

sh "echo Run:\"${params.Spec}\" >> allure-results/environment.properties"

Any help would be appreciated.

FOUND THE ANSWER HERE: How to pass variables from Jenkinsfile to shell command

userMod2
  • 8,312
  • 13
  • 63
  • 115
  • What do you get with this ```sh "echo Run:\"${params.Spec}\"```? – Tuan Aug 08 '17 at 05:11
  • @Tuan Nothing - I think i see the issue i',m passing a Jenkins variabel into the shell - how will shell know whats outside. Need to figure out how to pass that varibale into shell – userMod2 Aug 08 '17 at 05:37
  • 1
    https://stackoverflow.com/questions/28572080/how-to-access-parameters-in-a-parameterized-build – Tuan Aug 08 '17 at 05:51

0 Answers0