Package Import

Updated 1 month ago by Copado Solutions

There are cases where packages and their versions are created outside of Copado using the regular Salesforce DX CLI, for example when you are just starting to use Copado. If this is your case and you would like to import a package to Copado, follow the steps below:

Required permissions: 

  • Package Object and Field access, e.g., assign Copado User permission set.
  • Copado Job Engine & Functions, e.g., assign the Copado Functions and Copado Job Engine permission sets. 
  • Enable Package Import custom permission, e.g., assign the CMC SFDX Admin permission set. 
  1. In the CLI, list your orgs by running the command sfdx force:org:list, and select the dev hub where you have developed your work.
Make sure to connect the CLI to the org where you have been working. 
  1. Then, list the packages by running the command sfdx force:package:list, and select the one you want to import to Copado. This step is to have the package ID handy in step 5. 
  2. List the pipelines in Copado by running the command sfdx copado:pipeline:list. The pipeline record ID is also required in step 5.
  3. You also need the org credential of your dev hub. Since there’s no command yet implemented in the CLI, you need to go back to your Copado org and copy the ID from the URL. This ID needs to be added to the JSON file.
  • Sample file name: packageImport.json
  • File location: Repository root or tooling folder. The command examples assume the file to be in the repository root folder.
  • File content:
    {
    "devhub": "a0z09000001fQu1AAE"
    }

So far it contains only one parameter and the value is the Salesforce Record ID of the dev hub credential. The dev hub where the package is registered must be the one authenticated on the credential.

  1. Now, you need to type in the import command following the next structure:
    sfdx copado:package:import -f <configFileName> -l <pipelineRecordId> -p <packageId>

Where:

  • configFileName: insert the json file name of the package you want to import. If you placed the file in a tooling or sub folder, make sure to provide the proper relative path, e.g. ../Tooling/packageImport.json
  • pipelineRecordId: insert the pipeline ID where the package is being developed. 
  • packageId: insert the ID of the package you want to import.

  1. Once the package import has started you can view the progress by opening the job execution, typing the sfdx copado:record:open -f <JobExecutionID>  command. The CLI will open the job execution record in Copado, and in the SFDX Package Import list you can see the import status. 

Once the package and its versions are imported into Copado, you can perform the following operations:


How did we do?