2

My GitLab 18 instance is suggesting me to use inputs instead of variables;

Using inputs to control pipeline behavior offers improved security and flexibility. Consider updating your pipelines to use inputs instead.

We currently have variables like SSH_USER and SSH_HOST with values per branch, to deploy projects to their corresponding environments, when merging a merge-request.

How does this concept work with inputs instead of variables? I feel like these are two different approaches and you can't replace (all) variables with inputs.

1 Answer 1

1

I also think that currently, inputs will not replace variables everywhere. Your use case is one that is not supported by inputs. See the documentation at https://docs.gitlab.com/ci/inputs/#for-a-pipeline

You can set input values with:

Downstream pipelines  
Manually triggered pipelines.  
The pipeline triggers API  
The pipelines API  
Git push options  
Pipeline schedules  
The trigger keyword

I guess you could trick it since variables can be expanded in input values, but that sounds brittle.

Inputs seem to be mostly here to replace variables as a mechanism to configure template pipelines and components. In that respect they have great advantages over variables (they carry typing info, default values and documentation).

If you really want to use inputs here, you can refactor your per-branch job into a component, then include this component for each branch, and use inputs to configure it, but this may not be worth it to you. Variables are probably here to stay so I don't see an issue with your current setup.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.