6

I'm trying to run build_unlocked_test_package flow, followed by qa_org_unlocked. I don't get any commit status created automatically and I'm not sure how to generate it properly so that the resolver can find the package version id when executing the second flow. I'm getting the following error:

Could not find commit <commit_id> on GitHub
This error usually means your local commit has not been pushed or that a feature test package has not yet been built.
Exception in task install_unlocked_commit.github_package_data

Error: Could not find package version id in 'Build Unlocked Test Package' commit status for commit <commit_id>.
Run this command for more information about debugging errors: cci error --help

What is the proper way to manually create a test unlocked package and install it in a feature or qa scratch org? What if I'm using a persistent QA org? what if I'm not using GitHub Actions (CircleCI instead)?

Update:

I made sure I have github service connected: enter image description here

I also published the branch to GitHub

enter image description here

I ran the build_unlocked_test_package flow and it succeeded

enter image description here

I pulled the branch from GitHub, but nothing was changed. I ran the qa_org_unlocked flow anyways and got the same error:

enter image description here

2
  • I suggest you add to the question the package generation script and/or commands being used and what you have attempted so far. Commented Jul 24, 2023 at 18:01
  • 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. To start, I'm manually running these 2 flows sequentially. cci flow run build_unlocked_test_package cci flow run qa_org_unlocked
    – dangt85
    Commented Jul 24, 2023 at 18:10

1 Answer 1

5

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).

  1. 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.

  2. 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.

  3. 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
    
  4. 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.

4
  • thanks for the clarification. I am planning on using the build_unlocked_test_package flow in feature branches. I have used the other flows successfully to create beta and release versions for the distributable packages using beta and release branches. do flows like release_unlocked_beta update the commit status as well? they do work for me
    – dangt85
    Commented Jul 24, 2023 at 18:34
  • @dangt85 You know what, I forgot one key aspect of how this works - my apologies. Give me a few mins, I'll update my answer with the missing step to post commit statuses.
    – David Reed
    Commented Jul 24, 2023 at 19:24
  • Updated, apologies again for the confusion.
    – David Reed
    Commented Jul 24, 2023 at 19:56
  • 1
    Perfect, thanks for the clarification @david-reed - that worked
    – dangt85
    Commented Jul 24, 2023 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .