Disclosure: I am a Salesforce employee and the author of much of this code in CumulusCI.
There's a few different things that need to happen to make this very complex process work, but once you get them all in place, it should work 100% of the time.
(Edited because I myself forgot a step).
You must have a GitHub service authorized to CumulusCI. If you're running locally/interactively, you do this by running cci service connect github
. If you're running headlessly, you'll use environment variables.
As the message says, you must have pushed the commit you're working on so that there's a place to put the commit status.
You run the flow build_unlocked_test_package
. This flow should show you an 04t package version id in your logs. I would typically pipe this log to a file by doing
cci flow run build_unlocked_test_package --org dev | tee cumulusci.log
Use a shell script to grab the package id out of the log and send it to GitHub. We typically implement this as part of build automation rather than in CumulusCI itself, for complicated historical reasons. Here's one implementation:
STATUS=$(cat cumulusci.log | grep -o '04t[a-zA-Z0-9]*')
gh api \
--method POST \
-H "Accept: application/vnd.github.v3+json" \
'/repos/YOUR_REPO/statuses/COMMIT_SHA' \
-f state='success' \
-f description="version_id: $STATUS" \
-f context='Build Unlocked Test Package'
You would need to ensure that the GITHUB_TOKEN
environment var is set to a valid GitHub API token, and install the gh
CLI, to use this strategy. You'd need to substitute YOUR_REPO
and COMMIT_SHA
, likely with other environment vars, based on how your build system exposes that data.
If this succeeds, you should be able to see a commit status on your commit in GitHub, which will have an 04t
package version id in the description.
At that point, you can run qa_org_unlocked
. Note that you must still have the commit from (3) checked out in your local working directory.
If you've done all of these steps and it's still not working, please edit some additional detail into your questions and I can help triage.
What is the proper way to manually create a test unlocked package and install it in a feature or qa scratch org?
I aimed to cover this above, but please let me know if it's unclear.
What if I'm using a persistent QA org?
Doesn't really matter (although I hate persistent QA orgs!) - unlocked packages will upgrade on install, and I have tested this hands-on myself. You may want to run install_unlocked_commit
directly rather than qa_org_unlocked
if the latter also does configuration you do not wish to repeat in your persistent org.
what if I'm not using GitHub Actions (CircleCI instead)?
Doesn't matter so long as you provide GitHub authentication to CumulusCI as in (1) above.
From your comment:
I am developing an unlocked package. I have already created beta and release versions for the package but I'm trying to see if I can create the package versions in CircleCI
Bear in mind that the flows you are using are intended to facilitate testing prior to merging code. They shouldn't be used to create your distributable package versions. For that, see Release an Unlocked Package in the documentation.
cci flow run build_unlocked_test_package
cci flow run qa_org_unlocked