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 '[PackageA@1.3.4-2,' PackageB@1.0.2-1, PackageC@1.0.0-1]'
[2020-04-18T01:07:05.300Z] ERROR running force:package:install: Unexpected arguments: PackageA@1.0.2-1,, PackageB@1.0.0-1,, PackageC@1.0.0-1]
Here is how the Dependencies Map looks like:
"dependencies": [
{
"package": "PackageA@1.3.4-2"
},
{
"package": "PackageB@1.0.2-1"
},
{
"package": "Packagec@1.0.0-1"
}
]
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!