We have been working hard to make orb development a pleasant experience, and part of this means figuring out the best way to package orbs into their final form. To address this, we’ve created a new command for the CircleCI CLI:
orb pack. This behaves similar to the existing command used for packing orbs,
config pack, but with some orb-specific behaviour, We’re looking for orb developers to test this new command and help us catch edge cases we normally wouldn’t be able to.
Packing external scripts
First, we’ve introduced the ability to import other files into your packed orbs with the
<< include(filename) >> syntax. This can be scripts, JSON files, any sort of text you want to keep separate from the YAML for syntax highlighting (or other reasons)! These values will be replaced with the file contents when the orb is packed.
# email@example.com version: 2.1 # ... commands: foo: steps: - run: << include(scripts/hello-world.sh) >>
# src/scripts/hello-world.sh echo "Hello, world!"
version: 2.1 # ... commands: foo: steps: - run: echo "Hello, world!"
Stricter project structure
Second, we’re standardizing the form that “destructured orbs” take (the layout of the project’s directory). Orbs that need to be packed must have an
@orb.yml file, and will only pack the
jobs directories. So other directories, such as
scripts from the example, are ignored, and you won’t end up with empty entries in your configuration, such as
How do I start using it?
The command is present in the latest version of the CLI (v0.1.8731) (but it’s hidden).
While we’ve done our best to cover as many edge cases as possible, we’re limited by our sample size. We’re looking for more orbs to test against, preferably ones that will be able to take advantage of the features introduced. Give it a go, and please report any and all issues you encounter, either here or on GitHub.
We’re also working on the Slack orb to allow it to be more flexible, and utilises this new
orb pack command: https://github.com/CircleCI-Public/slack-orb/tree/Major-block-kit-redesign