-
Bug
-
Resolution: Not A Defect
-
Major
-
None
I've tried to move an entire declarative pipeline to a vars/.groovy file in order to globalize it in a shared library using new 1.2 declarative (as per documentation here
I have these files:
DeclataviePipeline.groovy
def call(String rutaPomXml, String rutaPomXmlEAR, String contextoUrl, Tipo tipo) { [...] //Some other stuffs pipeline { [...] //Some other stuffs stage('Preparing environment') { agent { label 'linux' } steps { preparaEntorno esLibreria: false } [...] //Some other stuffs }
preparaEntorno.groovy:
def call(args) { echo "Preparando entorno..." def esLibreria = args.esLibreria?:false echo "Is library? ${esLibreria}" if(esLibreria) { echo "Preparing environment for library" } else { echo "Preparing environment for app" } [...] //Some other stuffs
When pipeline runs, argument "esLibreria" is passed as "false" in preparaEntorno command but in console, I can see these messages:
[Pipeline] echo Is library?? false [Pipeline] echo Preparing environment for library
instead of
"Preparing environment for app"
It works when pipeline is not in a .groovy file in a shared library.