I can execute the following command against a Git submodule on my terminal. I basically just want to print out the path of the child module.
My Git submodule looks like
/path/submodule/module1
/module2
I can do this on the command line to print out the name of each child module
$ git submodule foreach 'echo $name'
Entering 'module1'
module1
Entering 'module2'
module2
However, if I do the following
node("buildNode)" {
stage("test") {
sh(label: "Test",
returnStatus: true,
script: """
git submodule foreach 'echo $name'
""")
}
}
I get the following error
ERROR: groovy.lang.MissingPropertyException: No such property: name for class: WorkflowScript
What's the correct syntax? TIA
The correct syntax is...
node("buildNode)" {
stage("test") {
sh(label: "Test",
returnStatus: true,
script: """
git submodule foreach 'echo \$name'
""")
}
}
Notice the \$name
.