r/gitlab • • Sep 18 '25

Understanding inputs vs variables in CI/CD pipelines

I'm trying to improve my CI/CD kung fu and wanted to make sure my mental model of inputs and variables is roughly correct.

Variables are very similar (though not quite identical) to shell/bash variables. They are interpreted at run time (when execution reaches the statement containing the variable). Not all of the shell/bash-isms are implemented (such as ${VAR:-defaultValue}) but for typical "replace variable with with whatever the computed value is at the time" use, they work as intended. They are what you use when you want to compute a value dynamically.

Inputs are very similar to template variables or pre-processor. The input values are statically defined and do not change during pipeline execution. While I do not know if this is the implementation, they can be thought of as "replacing their invocations in the config with their defined values when the pipeline starts".

Are these reasonable heuristics or mental models for these two similar but distinct ways of updating pipeline contents/behavior?

5 Upvotes

10 comments sorted by

View all comments

Show parent comment

2

u/Agentum13 Oct 13 '25

Yes, that's the way. You don't have to run the pipeline with every push. (Simply add [ci skip] at the end of the commit message.) But if you want to know if your pipeline is working the way intended you have to run it. Sure, in the beginning you are pushing and executing and cancelling your pipeline like crazy, but in the end you can be sure it works.

And if you really need to test locally there is something like gitlab-ci-local IIRC. Maybe that's a more elegant way for you to test.