CircleCI-Public / orb-tools-orb

Various tools for authoring and publishing CircleCI orbs
https://circleci.com/orbs/registry/orb/circleci/orb-tools
MIT License
51 stars 76 forks source link

CircleCI login is required if depending on an orb that is private #225

Open jenny-miggin opened 1 year ago

jenny-miggin commented 1 year ago

Orb version:

12.0.4

What happened:

When packing an orb that depends on another private orb in their namespace, the command fails as the user needs to log in via the CLI in order to find the specified org-id.

When using this job in a workflow:

- orb-tools/pack:
    filters: *filters
    org_slug: gh/my-org-slug

the job fails:

Error: failed to get the appropriate org-id: You must log in first.

Expected behavior:

The org-id can be found, enabling users to add an orb dependancy

Additional Information:

A workaround to this is to add a pre-step to the job, which uses the CLI to log in. This depends on the availability of an API key (CIRCLECI_API_TOKEN) within a context

- orb-tools/pack:
    filters: *filters
    org_slug: gh/my-org-slug
    pre-steps:
      - run:
          command: |
            circleci setup --no-prompt --token "${CIRCLECI_API_TOKEN}"
    context: my-context
Peter-Darton-i2 commented 1 year ago

FYI the usecase where I encountered this was when I wanted to make one of my (private-to-my-org) orb's jobs call upon a command that was in a different (private-to-my-org) orb. i.e. I was writing orb myorg/foo and its src/@orb.yml file said orbs: bar: myorg/bar ... and that then caused the build to fail. ... even after I'd added the org_slug parameter.

e.g. this orb built by this build (whose eventual failure is unrelated to this issue; that's a story for another day...)