Create a Packaging Org
Learning Objectives
- Describe the elements needed for a managed package.
- Create a packaging org.
- Connect CumulusCI to your packaging org.
Create the Org
Important: Do not use your Trailhead Playground as your packaging org. In this unit, you’ll sign up for a Developer org to use for packaging.
A packaging org is a Developer Edition org configured with a managed package namespace. The packaging org is where new versions of the package are created. Every managed package has one and only one packaging org.
The first step is to create a new Developer Edition org. Fill out the Developer Edition form to get yours.
Once the org has been created, be sure to click through the email confirmation and set a password for your user.
Configure the Packaging Org
Before using CumulusCI to release the Food Bank managed package, Tasha needs to create the package and claim a namespace for it. Managed package namespaces are globally unique, and help make sure that component names from our package won’t collide with names from other customizations or another package.
Follow along as Tasha gets to work.
In the packaging org, create a new package:
- Click and go to Setup.
- Use Quick Find to search for Package Manager.
- In Package Manager, click the New button in the Packages section to create a new package.
- Fill out the form with the following information:
-
Package Name:
Food-Bank
Note: To make sure that CumulusCI will add components to the correct package, it’s important that the Package Name is the same as the name of the project in yourcumulusci.yml
file. You’d find this by looking underproject
, thenpackage
, thenname
. In Start a Community Project with CumulusCI, you set this name to beFood-Bank
. - Language: choose your language
-
Configure Custom Link: leave as
--None--
- Notify on Apex Error: leave blank
- Description: add information about your new package!
-
Package Name:
- Click Save.
Next, assign a namespace for the managed package.
- In the Developer Settings panel on the Package Manager page in Setup, click Edit.
- Click Continue.
- Choose a namespace prefix. Keep these important considerations in mind:
- Namespaces can only be used once throughout the Salesforce ecosystem. For this project, select a long, nonsensical name that wouldn’t be used for a real project.
- Namespace prefixes can be up to 15 alphanumeric characters. Enter the prefix you’d like to claim and click the Check Availability button to see if it is available.
- Make a note of the prefix for later.
- Once you have a valid prefix, choose your package in the Package to be managed dropdown.
- Click Review My Selections, then click Save.
In order to deploy this package to the packaging org, CumulusCI needs to know the name and namespace of the package. To set this up:
- In GitHub Desktop, open your repository in the VS Code by choosing Repository→Open in Visual Studio Code.
- In the Side Bar, click on the
cumulusci.yml
file to open it. - Find the part of the file that looks like this:
project: name: Food-Bank package: name: Food-Bank
- Add a line to specify the package namespace:
project: name: Food-Bank package: name: Food-Bank namespace: myawesomenamespace
Double-check that the package name
is the same as what you entered for Package Name above. Press Command+s (macOS) or Ctrl+s (Windows) to save your changes to the cumulusci.yml
file.
Let’s make sure that your changes are pushed to GitHub—you’ll need this in the next unit’s Hands-On Challenge!
Open your repository in GitHub Desktop, then complete the following steps:
- Create a new feature branch to store the changes. In GitHub Desktop, choose Current Branch→New Branch, and name the branch
feature/set-namespace
. Choose to bring your changes to the new branch. - In GitHub Desktop, on the
feature/set-namespace
feature branch, make a commit with the messageSet package namespace
. - Publish the feature branch to GitHub by clicking Publish branch on the information pane that comes up after your commit is complete.
- When the information pane updates after publishing, click Create Pull Request to create a new Pull Request for this change.
- GitHub Desktop will automatically navigate you to the Open a pull request screen in your web browser.
- Under the header Changes, add a line to describe what you did.
- Click Create Pull Request.
- On the next screen, click Merge pull request. Click Confirm merge.
- Click Delete branch to remove the branch we just merged.
Connect the Org to CumulusCI
CumulusCI supports attaching existing Salesforce orgs to the project. To kick that process off:
- In GitHub Desktop, open your repository in the VS Code by choosing Repository→Open in Visual Studio Code.
- In the Terminal window, enter:
cci org connect packaging
This command will open a Salesforce login page in your browser. Log in using the username and password for the org you created for your packaging org. After logging in, you'll be prompted to grant access to the org. Once you click Allow, you'll see “Congratulations! Your authentication succeeded.” in the browser.
Return to the VS Code Terminal to confirm the org is now connected by entering this command: cci org list
It should display a table like this:
┌Connected Orgs───────┬───────────────────────┬──────────┐ │ Name │ Default │ Username │Expires │ ├──────────┼──────────┼───────────────────────┼──────────┤ │packaging │ │ tasha@foodbankdev.org │Persistent│ └──────────┴──────────┴───────────────────────┴──────────┘
You can also directly open the packaging org anytime in the browser with this command in your Terminal: cci org browser packaging