Start Building for Free

Create an orb

5 months ago4 min read
Server v4.x
Server v3.x
On This Page

This tutorial guides you through creating a new orb using the orb development kit. The starting point is creating a new repository on

Following this tutorial you will:

  • Create a GitHub repo for your orb.

  • Add templated orb config, based on your requirements.

  • Set up a CI/CD pipeline for orb development and put restrictions on who can contribute towards the development of your orb.

At the end of the tutorial you will be ready to configure your orb.

These steps are also outlined in the following video.

Create and initialize an orb


  • A GitHub account connected to your CircleCI account. See the Sign up and try page for steps to get set up.

  • Set up the CircleCI CLI on your local machine with a personal access token. Ensure you are using the latest version of the CircleCI CLI. You must be using version v0.1.17087 or later.

    $ circleci update
    $ circleci version
  • Register a namespace for your GitHub organization. Ensure the organization on GitHub is the owner for the CircleCI namespace for which you are developing your orb (this will be automatically configured correctly if you are using your own personal organization and namespace).

Create your orb

1. Create a new repo

Create a new, empty, GitHub repository. The name of your repository is not critical, but something similar to "myProject-orb" is recommended.

New GitHub Repo

Once complete, you should see the generated git URL. Note it down, you will need it in step 4. You can select SSH or HTTPS, whichever you can authenticate with.

Orb Registry

2. Initialize your orb

Open a terminal and initialize your new orb project using the orb init CLI command as shown below. The circleci orb init command is called, followed by a path to create and initialize for your orb project. It is best practice to use the same name for this directory and the git project repo.

  • To initialize a public orb:

    circleci orb init </path/to/myProject-orb>
  • To initialize a private orb:

    circleci orb init </path/to/myProject-orb> --private

3. Choose the fully automated orb setup option

? Would you like to perform an automated setup of this orb?:
   ▸  Yes, walk me through the process.
      No, I will handle everything myself.

When choosing the fully automated option, the orb template is downloaded and automatically modified with your customized settings. The project will be followed on CircleCI with an automated CI/CD pipeline included.

For more information on the included CI/CD pipeline, see the Orb publishing process page.

4. Follow the prompts to set up your orb

In the background, the orb init command copies and customizes the orb template based on your inputs. There are detailed files within each directory that contain helpful information specific to the contents of each directory. You will also be asked for the remote git repository URL that you obtained back in step 1.

The orb template contains a full CI/CD pipeline (described in orb publishing process), which automatically packs, tests, and publishes your orb.

In the setup process you will be asked if you would like to save your personal API Token into an orb-publishing context. Saving this token is necessary for publishing development and production versions of your orb. If you have already made an orb in the past, you can skip this step, as the context will already exist.

5. Restrict who can trigger jobs for the orb

Use security groups to limit access to users that are allowed to trigger jobs. Only these users will have access to the private personal API token.

Contexts can be located by navigating to Organization Settings > Contexts in the web app. After creating your orb, you will have a new context called orb-publishing. Click into orb-publishing and add a Security Group.

Secure contexts

6. Push changes to GitHub

During the setup process, the orb init command prepares your automated orb development pipeline. The modified template code produced by the CLI must be pushed to the repository before the CLI can continue and automatically follow your project on CircleCI.

Run the following command from a separate terminal when prompted to do so, substituting the name of your default branch:

git push origin <default-branch>

Once complete, return to your terminal and confirm the changes have been pushed.

7. Complete the setup

Once the changes have been pushed, return to your terminal and continue the setup process. The CLI will now automatically follow the project on CircleCI, and attempt to trigger a pipeline to build and test your orb with sample code.

You will be provided with a link to the project building on CircleCI where you can view the full pipeline. You should also see the CLI has automatically migrated you into a new development branch, named alpha. You can use any branch naming you would like, you do not need to exclusively develop on alpha.

8. Enable Dynamic Configuration

Using the orb development kit makes use of Dynamic configuration, you will need to enable this feature. You will receive an error on your first pipeline that will state that this feature is not yet enabled.

Following the Getting started with dynamic config in CircleCI guide, open the Project Settings page for your orb on CircleCI, navigate to the Advanced tab, and click on the Enable dynamic config using setup workflows button.

Once enabled, all future commits to your project will run through the full pipeline and test your orb. You could manually re-run the pipeline at this point, but since you are only working with sample code at this moment, it is not necessary.

9. Develop your orb

From a non-default branch (you will be moved to the alpha branch automatically at setup), begin modifying the sample orb code to fit your requirements. On each push, your orb will be automatically built and tested. More information on developing your orb can be found on the Orb authoring process page.

Be sure to view the .circleci/test-deploy file to view how your orb components are being tested, and modify your tests as you change your orb. Learn more about testing your orb on the Orb testing methodologies page.

When you are ready to deploy the first production version of your orb, find information on deploying changes on the Orb publishing process page.

Build and test an orb

Next steps

Help make this document better

This guide, as well as the rest of our docs, are open source and available on GitHub. We welcome your contributions.

Need support?

Our support engineers are available to help with service issues, billing, or account related questions, and can help troubleshoot build configurations. Contact our support engineers by opening a ticket.

You can also visit our support site to find support articles, community forums, and training resources.