Is your feature request related to a problem? Please describe.
In a CI/CD setup, I automate the creation of package versions. No developers maintain the sfdx-project.json file. We are creating 2GP managed packages and one of the requirements for a new managed package version to be upgradeable in the subscriber org is if the new package version specified an ancestor id.
Currently, the ancestor package version id can only be specified in the sfdx-project.json file. Which means someone or something must manage this file before running the force:package:version:create command.
What are you trying to do
Specify the ancestor package version id as an argument to force:package:version:create command like I can specify versionnumber so that it is easier to script package version creation with no maintenance of sfdx-project.json.
Describe the solution you'd like
A new flag added to the force:package:version:create command to specify the ancestor.
--ancestor -c -- ID (starts with 05i) or alias of the immediate parent package version of the version to be created
Example Usage
sfdx force:package:version:create --ancestor 05iB00000004CIeIAM --versionnumber 1.2.0.5 --package MyPackage
sfdx force:package:version:create -c 05iB00000004CIeIAM -n 1.2.0.5 -p MyPackage
Describe alternatives you've considered
In our CI/CD service, I use a custom bash script to update the sfdx-project.json with the ancestorId value, create the package version, then discard the file changes.
https://gist.github.com/douglascayers/e3a9525729a1b512618adf720e3fbe94
With that script, then our project's sfdx-project.json can be as simple as the following and never be updated or maintained as the script handles determining the correct next major.minor.patch.build version number, ancestor id, and promoting versions.
{
"packageDirectories": [
{
"path": "force-app",
"default": true,
"package": "MyPackage",
"versionNumber": "1.0.0.NEXT"
}
],
"namespace": "my_namespace",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "46.0",
"packageAliases": {
"MyPackage": "0Hoxxx"
}
}
Is your feature request related to a problem? Please describe.
In a CI/CD setup, I automate the creation of package versions. No developers maintain the
sfdx-project.jsonfile. We are creating 2GP managed packages and one of the requirements for a new managed package version to be upgradeable in the subscriber org is if the new package version specified an ancestor id.Currently, the ancestor package version id can only be specified in the sfdx-project.json file. Which means someone or something must manage this file before running the
force:package:version:createcommand.What are you trying to do
Specify the ancestor package version id as an argument to
force:package:version:createcommand like I can specifyversionnumberso that it is easier to script package version creation with no maintenance ofsfdx-project.json.Describe the solution you'd like
A new flag added to the
force:package:version:createcommand to specify the ancestor.Example Usage
Describe alternatives you've considered
In our CI/CD service, I use a custom bash script to update the
sfdx-project.jsonwith theancestorIdvalue, create the package version, then discard the file changes.https://gist.github.com/douglascayers/e3a9525729a1b512618adf720e3fbe94
With that script, then our project's
sfdx-project.jsoncan be as simple as the following and never be updated or maintained as the script handles determining the correct next major.minor.patch.build version number, ancestor id, and promoting versions.