I am trying to create a Jenkins pipeline to install package dependencies and my code looks like this:
def data = readJSON file:'sfdx-project.json'
for (item in data.packageDirectories.dependencies) {
println "${item.package}"
sh "${SFDX} force:package:install -p ${item.package}"
}
But whenever this runs in jenkins it fails with this error:
[2020-04-18T01:07:04.729Z] + node_modules/sfdx-cli/bin/run force:package:install -p '[[email protected],' [email protected], [email protected]]'
[2020-04-18T01:07:05.300Z] ERROR running force:package:install: Unexpected arguments: [email protected],, [email protected],, [email protected]]
Here is how the Dependencies Map looks like:
"dependencies": [
{
"package": "[email protected]"
},
{
"package": "[email protected]"
},
{
"package": "[email protected]"
}
]
To me it looks like that for some reason it is not properly iterating over the items in data.packageDirectories.dependencies.
Any ideas/Recommendations on how to solve this would be awesome. Fairly new to groovy so if I am doing something noobish point it out!