From df19bb2f73eb0e055f275527b16172fe891e4e90 Mon Sep 17 00:00:00 2001 From: ANGkeith Date: Fri, 4 Oct 2024 12:39:11 +0800 Subject: [PATCH] docs: add docs for project-variables --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b892c63..01269a79 100644 --- a/README.md +++ b/README.md @@ -276,14 +276,29 @@ gitlab-ci-local --remote-variables git@gitlab.com:firecow/example.git=gitlab-var ### Project file variables -Put a file like this in `$CWD/.gitlab-ci-local-variables.yml` +The `--variables-file` [default: $CWD/.gitlab-ci-local-variables.yml] supports the following format +#### yaml ```yaml --- AUTHORIZATION_PASSWORD: djwqiod910321 DOCKER_LOGIN_PASSWORD: dij3213n123n12in3 -# Will be type File, because value is a file path KNOWN_HOSTS: '~/.ssh/known_hosts' + +# This is only supported in the yaml format +# https://docs.gitlab.com/ee/ci/environments/index.html#limit-the-environment-scope-of-a-cicd-variable +EXAMPLE: + values: + "*": "I am only available the rest of the jobs" + staging: "I am only available in jobs with `environment: staging`" + production: "I am only available in jobs with `environment: production`" +``` + +#### .env +``` +AUTHORIZATION_PASSWORD=djwqiod910321 +DOCKER_LOGIN_PASSWORD=dij3213n123n12in3 +KNOWN_HOSTS='~/.ssh/known_hosts' ``` Variables will now appear in your jobs.