Strings using single quotes do not do variable expansion; you must use double quotes to have the variables expand. So: '$var' is the literal string $var "$var" expands to the string value of the variable $var
and the same is true for multi line strings '''---- $var ----''' does not expand """---- $var ----""" expands the value of $var https://jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation On Tue, Apr 16, 2019 at 9:23 PM b o b i <[email protected]> wrote: > I cannot make the executed shell to resolve a predefined variable in my > jenkins script.. I tried various syntax approaches w/o succcess. .. > > Anybody could give me a hand? > > > String workspace > String addOn = "Path/To/Cmake.cmake" > > node ('slave01') { > workspace = pwd() > String addOnAbsPath = "${workspace}/$toolchainCmake" > > stage ('Build') { > > // for some reason is not recognize, thats why > sh "echo ${addOnAbsPath}" > sh ''' > echo Path: '$addOnAbsPath' > ''' > sh '''#!/bin/bash > echo ${addOnAbsPath} > cmake ... -DADD_ON=$addOnAbsPath ... > ''' > } > } > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/01535995-02a9-46ce-8388-ca01695dbbb9%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/01535995-02a9-46ce-8388-ca01695dbbb9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO37hbg-s5Fk5Sb74y8ccS3gNapuiuqa6RcxAP2Jw64VJmn3yw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
