ENV type in orbs

envars

#1

I came across an issue while attempting to use the orb iynere/compare-url@0.3.1(https://circleci.com/orbs/registry/orb/iynere/compare-url) that I was curious about the right way to fix.

The orb uses a parameter circle-token of type env_var_name. This prohibits it from being cast as a string, meaning you can’t set it to $CIRCLE_TOKEN and instead should set it to CIRCLE_TOKEN. But the problem here is that when its referenced from inside a command (like here) it replaces it as if it’s a string (CIRCLE_TOKEN instead of $CIRCLE_TOKEN).

Is this the expected behavior? I would assume that since it’s the env_var_name type, we could assume it is output as a reference to an ENV variable. Obviously a solution is to just put “$” in front of the <<parameters.circle-token>>, but what is the point of that specific type in that case? Thanks!


#2

Hi @jaumann, I recently refactored the orb to use the env_var_name parameter type, so I think what you’ve found is just a little bug that I missed! And didn’t notice, since I use it mostly with open-source projects where the token is not required for API calls.

I’ll fix this quick, and in the future, feel free to file issues like this here:


#3

Oh no worries. I was going to submit a PR but I wasn’t sure if it was an issue with the env_var_name type, or with the template. I mentioned it in the issue (https://github.com/iynere/compare-url-orb/issues/11), but I wasn’t sure the right way to go. Thanks for the awesome support!


#4

Patched! Closing this thread for now. Stoked that folks are using my orb!


#5