How to set default values for pipeline variables?

Hello, is there anyway to set a default value for a pipeline variable? I’d like to have the variable available and overridable, but if it doesn’t get set, it should use the default value. Thanks.

Yes we can put them on the project level and then override them in the pipeline level. Or put them in the pipeline level and override inside the yaml

Here are the rules

https://codefresh.io/docs/docs/codefresh-yaml/variables/#user-provided-variables

You can also use Shared configuration · Codefresh | Docs

Hi Kostis,

Our use case is we want to expose an optional pipeline variable. If the value of the variable is specified when executing the pipeline, then that is the value that would be used. If the value isn’t provided, the pipeline should be smart enough to detect this and use a default value.

My understanding is there’s no step out of the box as such provided by CodeFresh to provide a default value for an optional pipeline variable. We still need to write a step that checks this variable - if value doesn’t exist, cf_export it with a default value.

Is this how you see this can be solved?

Hello

You can do different steps according to the presence of a variable like this.
https://codefresh.io/docs/docs/codefresh-yaml/conditional-execution-of-steps/#execute-steps-according-to-the-presence-of-a-variable

would that work for you?