Codefresh variables should be always available

Codefresh provides a mechanism that allows the pipelines to retrieve variables. The normal way to do so is to use the ${{VARIABLE}} format.

I have encountered multiple times an unexpected behavior while using this format: Whenever a variable is not available it does not get replaced and the placeholder simply stays there as-is.

As an example if I try to use the variable ${{MYVARIABLE} which has not been defined, the final YAML won’t have an empty string as a replacement to the placeholder, nor will the pipeline fail because there is an undefined variable. The placeholder will simply stay there as it is.

To make things even worse, the system provided variable that I always expected to be set to some value turned out not being set in multiple occasions.

I’d like to bring as an example the CF_PULL_REQUEST_TARGET, the expected behavior is that this variable will be empty when the pipeline is manually run or the webhook event is not a pull request. The result instead is that the variable is not available and the placeholder doesn’t get replaced.

This behavior is also inconsistent with the normal behavior of the dollar $ in UNIX systems (e.g. echo $MYVARIABLE) used to access environment variables.


I passed your feedback to our dev team and they agree completely. We created an internal feature request and will plan soon.

1 Like

Thank you very much!

As a side note, I think that undefined variables should just return a warning - and maybe a “strict mode” could be optionally enabled to force undefined variables to generate an error.

A strict mode could be used, of course, for other purposes as well.