CumulusCI includes a custom implementation of support for 2GP that takes a different approach than sfdx allowing for a better user experience and unlocking new capabilities for product teams. I’ll cover what’s different and the advantages that difference creates in this post.
CumulusCI’s 2GP support is now over 2 years old and has been continually enhanced and matured over that time.
CumulusCI’s approach to user experience has always been about making complex tasks easy for users. We designed the 2GP implementation to reduce the need for manual steps wherever possible.
Aside from the fact that the end result is a 2GP package, CumulusCI’s implementation is completely custom and doesn’t utilize sfdx’s 2GP functionality. Instead, it directly interacts with the relevant objects in the Tooling API:
By directly interfacing with the Tooling API objects, we were able to completely rethink the developer experience of creating 2gp packages. That enabled us to do things like:
All of these come together to create an amazingly seamless user experience for creating and releasing 2GP products.
Almost all the logic for creating package versions lives in the create_package_version
task which has options to specify the package name, type, and various other packaging options.
CumulusCI has always had built in flows for release operations that automate interaction with GitHub to create release artifacts like tags and releases. The built in release_2gp_beta
and release_2gp_production
handle the release operations automation for creating 2GP beta versions and promoting them to production.
More details about these flows is available in the Release Managed and Unlocked Packages section of CumulusCI documentation.
The best way to illustrate the user experience made possible by CumulusCI’s 2GP implementation is to show the process of creating a new project, creating and testing a beta verison, then promoting it to production.
This demo uses the following commands:
# Create local git repo
$ mkdir CumulusCI2GPDemo
$ cd CumulusCI2GPDemo
$ git init
# Initialize CumulusCI
$ cci project init
# Create Dev Org
$ cci org default dev
$ cci flow run dev_org
# This demo existing package metadata. If you want to try yourself,
# you can use the following commands to access the scratch org and
# capture your changes from the org into the package source.
# You can also use VS Code or sfdx to capture the changes
$ cci org browser
$ cci task run retrieve_changes
# Commit local files
$ git add --all
$ git commit -m "Initial configuration for CumulusCI"
# Not shown in demo but required: Create a GitHub repo, link your
# local to it, and push using whatever git tooling you like
# Create 2GP Beta Version (and Package)
$ cci flow run release_2gp_beta
# Test the 2GP Beta Version in a new Scratch Org
$ cci flow run ci_beta --org
# Promote the 2GP Beta Version to Production
$ cci flow run release_2gp_production
And now, kick back and watch how easy it is to create 2GP package releases with CumulusCI in this screencast demo:
CumulusCI’s 2GP implementation takes a different approach to sfdx’s 2GP implementation. By interacting directly with the Tooling API objects for 2GP packaging, CumulusCI’s implementation is able to automate more of the user experience making 2GP packaging more powerful and adds new capabilities to 2GP based processes not available in sfdx alone.
While CumulusCI comes with a best practices based release operations automation, there are many options available to adapt to most product strategies and package architectures. Interested in learning more? Grab some time for us to chat at https://calendly.com/muselab