Using the CLI to validate a config that references a private orb

I’m attempting to cut down on copy/pasta through our multiple repos by using private orbs. I’ve built a simple orb to test things out and verify our workflow and I have one sticking point, a .circleci/config.yml will not validate using circleci config validate when a private orb is referenced. I’ve committed the config.yml and it runs perfectly fine in CircleCI.

When I run the validate, I receive the following error:

➜  test git:(orbify) ✗ circleci config validate
Error: Cannot find xxx/orbtest@0.0.1 in the orb registry. Check that the namespace, orb name and version are correct.
Cannot find xxx/orbtest@0.0.1 in the orb registry. Check that the namespace, orb name and version are correct.
➜  test git:(orbify) ✗ circleci orb list xxx --private
Orbs found: 1. Showing only private orbs.

xxx/orbtest (0.0.1)
➜  test git:(orbify) ✗ circleci version  
0.1.15973+ce8624c (homebrew)

As you can see, the orb is available (sorry for the masked namespace and name). Are there plans to add this functionality into the CLI anytime soon? Having to do a commit and check the CircleCI project is a bit cumbersome and wastes a fair amount of time.

1 Like

Hi @mwhitney-rbi, and welcome to the CircleCI Discuss community!

This is indeed a limitation when using private orbs. In this case, you can validate your configuration with:

config validate --org-slug <your-org-slug> <path/to/config.yml> 

 
Let me know if this helps.

1 Like

@yannCI thanks! I knew I was missing something from the documentation. However, even using the org slug, I’m not able to validate and get a permission denied even though I can list the orbs fine.

➜  test git:(orbify) ✗ circleci orb list xxx --private                             
Orbs found: 1. Showing only private orbs.

xxx/orbtest (0.0.1)

➜  test git:(orbify) ✗ circleci config validate --org-slug xxx .circleci/config.yml
Error: Unable to validate config: Permission denied

same problem, private orb just throws “Error: Unable to validate config: Permission denied”

1 Like

@yannCI same for us. Trying to solve an issue where the web portal shows no workflows, and the local validate complains about our private orbs.

Is issue this still unresolved?

I was able to get this to work by specifying the --org-slug as github/org

1 Like

I had seen the notes about it not working at all, so this is a big improvement (being able to specify --org-slug)!. For me, this works great, and I’m now able to validate configs with private orbs.

That said, wonder if there’s any plan to add any further improvements, like letting you set an organization to search for private orgs by default?

for publishing, I see this config in cli.yml:

orb_publishing:
    default_namespace: ""
    default_vcs_provider: ""
    default_owner: ""

I tested, and populating these values (or setting org_slug there) did not seem to work, but it would be nice if the CLI config could either infer the slug from those fields in orb_publishing, or have a parallel field for validation.

If you’re receiving:

Error: Unable to validate config: Permission denied”

Then you need to provide your token for using CircleCI with the --token flag.

This is still not working for me. Upgraded to cli version 0.1.17183 and even with the org slug option and the --token flag, commands are still failing. Without org slug, receive message “Cannot find org_name/orb_name in the orb registry.” With org slug and --token, message is “Error: Unable to validate config: Permission denied”. As the user above, I"m able to list the orbs and get orb info just fine. Are there specific permissions necessary in git or circle to validate config using a private orb?

In case this helps someone else (or me in the future), I was also getting the Error: Unable to validate config: Permission denied message and the --token parameter didn’t seem to fix it. My problem was I was passing our GitHub org name directly as --org-slug <org> instead of --org-slub github/<org>. Doing that and using --token allowed me to successfully validate my config using the CLI.

After giving up a month ago, I came back to this today and identified the problem within 3 minutes: the org-slug is case sensitive. Even though my org on github is all lowercase (accessible at github.com/{my-org}), it contains a capital letter in circleci (My-Org). I had assumed that they used the same convention, and never bothered to confirm the official circleci org name. --org-slug github/{My-Org} got things working.