texei-sfdx-plugin
texei-sfdx-plugin copied to clipboard
Unclear instructions for passing installationkeys to package:dependencies:install
Hi,
I like your plugin but am a bit confused about how to use package:dependencies:install command in my project.
I have my four unlocked packages (core, application-log, bypass-api and permission-set-groups), all of them installation key protected. Some of them are dependent on managed packages, no need to pass the installation key.
When I run
sfdx texei:package:dependencies:install -r -k "1:key1234 2:key4321 3:key2345 4:key3210"
I get an error
Installing package 04t3z000001gxxxxx2 : application-log 0.0.1.LATEST
ERROR running force:package:install: Invalid InstallationKey for SubscriberPackageVersion
ERROR running texei:package:dependencies:install: sfdx force:package:install --targetusername [email protected] --package 04t3z000001gxxxxx2 --wait 10 --publishwait 10 --noprompt` failed with code 1
It seems like the installation key wasn't picked for my unlocked package at all.
Am I using the notation for --installationkeys parameter correctly ? My understanding is that for first unlocked package it picks "1:key1234", for second it picks "2:key4321" and so on..
My sfdx-project.json
{
"packageDirectories": [
{
"package": "core",
"default": true,
"path": "./sfdx-packages/core",
"versionName": "Org's core - Pre-release One",
"versionNumber": "0.0.1.NEXT",
"dependencies": [
{
"package": "managed-package-1"
},
{
"package": "managed-package-2"
},
{
"package": "managed-package-3"
},
{
"package": "managed-package-6"
},
{
"package": "managed-package-4"
},
{
"package": "managed-package-5"
},
{
"package": "application-log",
"versionNumber": "0.0.1.LATEST"
},
{
"package": "bypass-api",
"versionNumber": "0.0.1.LATEST"
},
{
"package": "managed-package-7"
}
]
},
{
"package": "application-log",
"default": false,
"path": "./sfdx-packages/application-log",
"versionName": "Application Log - Pre-release One",
"versionNumber": "0.0.1.NEXT"
},
{
"package": "permission-set-groups",
"default": false,
"path": "./sfdx-packages/permission-set-groups",
"versionName": "Permission Set Groups - Pre-release One",
"versionNumber": "0.0.1.NEXT",
"dependencies": [
{
"package": "managed-package-1"
},
{
"package": "managed-package-2"
},
{
"package": "managed-package-3"
},
{
"package": "managed-package-6"
},
{
"package": "managed-package-4"
},
{
"package": "managed-package-5"
},
{
"package": "application-log",
"versionNumber": "0.0.1.LATEST"
},
{
"package": "bypass-api",
"versionNumber": "0.0.1.LATEST"
},
{
"package": "managed-package-7"
},
{
"package": "core",
"versionNumber": "0.0.1.LATEST"
}
]
},
{
"package": "bypass-api",
"default": false,
"path": "./sfdx-packages/bypass-api",
"versionName": "Bypass Api - Pre-release One",
"versionNumber": "0.0.1.NEXT"
}
],
"namespace": ""
}
Thank you.
Honza
Thanks for the feedback, I should improve the description on the flag then.
The idea behind the 1: 2: ... thing is that looking at the package dependencies, there is no way to know if one package needs an installation key or not.
So you'll need to let the command know which package needs an installation key, and which one doesn't need one. If your package needs an installation key, you just add it as you already did: 1:key1234
, if your package doesn't need an installation key, you just set it as empty: 1:
.
So for the "permission-set-groups" package, you would write:
sfdx texei:package:dependencies:install -r -k "1: 2: 3: 4: 5: 6:key1234 7:key4321 8:key2345 9:key3210"
Thanks for the prompt response.
Unfortunately, I still can't understand how the notation can be applied to multi-package project. As you can see in the sample sfdx-project.json, apart from permission-set-groups, I have other packages as core, application-log and bypass-api. Rather than indexes, I can imagine to use package name to installation key notation, e.g. "core:key1234, application-log:key4321, managed-1:test1234".
Just as proof of concept, I have set all the installation keys to "test1234" and tried this command:
sfdx texei:package:dependencies:install -r -k "1:test1234 2:test1234 3:test1234 4:test1234 5:test1234 6:test1234 7:test1234 8:test1234 9:test1234 10:test1234 11:test1234"
...as I counted 11 different package references in my project. Some of the packages don't need installation key but it doesn't seem to be falsy.
Unfortunately, I ran into another error state:
ERROR running texei:package:dependencies:install: `sfdx force:package:install --targetusername [email protected] --package 04t3z000xxxxxx --installationkey :test1234 --wait 10 --publishwait 10 --noprompt` failed with code 1
Script seems to pick installation key ":test1234" (with the colon) instead of "test1234" even though the command seems to be correct to me.
You're right, I think this doesn't work well with multi-package projects. We haven't used them a lot as there are some bugs with the CLI (for instance when you push, it doesn't handle custom labels in several packages correctly), but Salesforce is fixing this.
So we need to update this command.
What you could do in the meantime, is run the command once for every package, by adding the package name: --packages core
.
Can you try if this works ?
That worked. Thanks for your help ! :)
I agree with @honzaluksch package name alias would be great rather than indexes. But thanks for suggesting the workaround @FabienTaillon