Pipeline Variables not valid in Orbs?

I’m trying to use the following in an orb command

  - when:
      condition:
        equal: [ master, << pipeline.git.branch >> ]

However when I try to validate it I’m getting

Error: Error calling command: 'command-name'
Unknown variable(s): branch

Are pipeline variables not valid in orbs ?
https://circleci.com/docs/2.0/pipeline-variables/

Pipeline variables are not in scope in orbs - https://circleci.com/docs/2.0/pipeline-variables/#the-scope-of-pipeline-parameters

You can declare parameters to the orb and pass the values in that way.

-Gordon

1 Like

Does the same scope restriction apply to orbs that embed steps from consumers?

For example, I have an orb that takes a number of steps and wraps them with custom commands. It appears that consumers are unable to use pipeline parameters in the steps passed to the orb (even though the pipeline parameters are used in the steps defined in the main config file).

This isn’t ideal. If I try to pass <<pipeline.git.branch>> to a job this way, it results in Error calling workflow: 'my-workflow'Error calling job: 'my-job'Unknown variable(s): branch whenever a tag is created. It does work on actual branches at least.

Found out that the trick here is to provide a fallback value to prevent it from erroring, i.e. <<pipeline.git.branch>><<pipeline.git.tag>>

Mustache conditionals can be used too, although it’s not well documented: "Correct" way to pass the branch name to orbs