Plus updates to the CLI orb so you can setup CI faster

Last December we announced our first collaboration with CircleCI in the form of a new orb for setting up your automated CI using the Salesforce CLI. Over the last 6 months we’ve continued working with CircleCI and today we’re announcing a new orb focused on setting up an org for Apex testing.

What are orbs?

Orbs are reusable chunks of configuration that you can call as part of your DevOps pipeline and workflow. CircleCI maintains a registry of these sharable packages of configuration that they’ve built along with their partners and other individuals. This way, anyone using CircleCI can drop these repeatable configuration orbs into their CI/CD pipelines with ease.

We’ve been working with CircleCI to create orbs that are specific to Salesforce Development so that instead of each team starting from scratch writing their own configuration, teams can easily use best practices and repeatable code, with these Salesforce Orbs.

Our first orb [salesforce-sfdx] focused on setting up the CLI and getting your CI ready for automated testing. The second orb [salesforce-apex] focuses on getting your changes into a testing org and running your Apex tests.

The salesforce-apex Orb

The new Apex orb is focused on testing your Apex code. It utilizes common commands and workflows for testing Apex. This includes:

  • Setting up a Scratch org for testing
  • Deploying your metadata to your test Sandbox
  • Running your Apex tests in your org

The orb is a sequel to the original CLI orb and picks up where that one left off.

We know that many of our users have more complex setups. What’s great about this orb is it allows you to use each command set alone. This means if you need to insert more complicated org setup or testing into your CI process, you can call individual sections of the orb and insert your extra steps in between. For teams with more straight forward Salesforce projects, you’ll be able to use an out-of-the-box job that creates, tests, and deletes a scratch org all in one go.

Salesforce CLI orb updates

Our first orb did a little bit of everything. We noticed that it was mostly used for setting up your CI process with the Salesforce CLI and creating Scratch orgs, so we streamlined it to focus on those two themes. Now the salesforce-sfdx orb is focused on installing the CLI, authenticating to your devhub, and creating a scratch org (if scratch orgs are part of your testing process). Each of these actions can be used on its own from the orb or together.

The orb used to also include the deployment of metadata into the scratch org, but we’ve moved that to the Apex orb in an attempt to streamline the orgs and not include repeated behavior. Orbs can be used together in a single .yml file, so we felt it was better to split the orbs up by category.

Conclusion

To learn more about how to use these orbs, please see CircleCI’s blog post on the new Apex orb and the Salesforce CLI orb. We continue to try to bring our development community more access to modern CI/CD best practices and hope to make it easier for anyone developing on Salesforce to take advantage of automated testing. We will continue to work with CircleCI to bring more configuration… please let us know on Twitter or in the Trailblazer Community if there are other Orbs you’d like to see!

About the Author

Claire Bianchi, Director, Product Management

Claire Bianchi is the Product Manager for the Salesforce CLIs and New Code Builder (Pilot). She joined Salesforce in June 2018 and has been working on improving developer tooling and experience ever since. Prior to this role she was at Atlassian as the Product Manager of the Bitbucket Ecosystem and Front End teams. She is currently focused on bringing modern development and devops best practices to all Salesforce developers regardless of skill level or experience.
Trailhead: https://trailhead.salesforce.com/en/me/005500000085ap7AAA
LinkedIn: https://www.linkedin.com/in/clairebianchi/
Twitter: @ClaireSFDX

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS