Predefined variables

Hi all!
I installed gitlab ce in docker. And tested CI. It is working normally.
I have a problem with predefined variables.
I can not build pipeline with predefined variables. Are there values with predefined variables.

Can you share an example configuration of .gitlab-ci.yml that helps to understand the question? I assume you want to add variables into the configuration and use them, something like this:

variables:
  VAR1: "val1"

test-job:
  script:
    echo $VAR1 

Hi Michael

I want to use like this pipeline

workflow:
rules:
- if: $CI_COMMIT_BRANCH != “main” && $CI_PIPELINE_SOURCE != “merge_request_event”
when: never
- when: always

- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY

Here CI_COMMIT_BRANCH , CI_PIPELINE_SOURCE, CI_REGISTRY_USER, CI_REGISTRY_PASSWORD are predefined variables

How can I add these variables to server.

When a pipeline is executed, these variables are pre-filled automatically. You can access these variables in the CI/CD jobs to control when they are executed (using rules), or in the script section to use them for container registry login, changing a path, etc.

Yes you are right.
After installing server in virtual machine. Predefined variables can be usable.

Thank you!

1 Like