firecow/gitlab-ci-local

Documentation: Rename example for env file

Closed this issue · 5 comments

gbmd commented

The readme suggests the following:
Add a .gitlab-ci-local-env file to the current working directory or a .env file in $HOME/.gitlab-ci-local.
According to gcl --help though, the default name is .gitlab-ci-local-variables.yml.
It took me some time to figure out why my variables were not accessible inside my executor's docker containers.
So I would suggest to make the documentation a bit more self-explanatory like this:

Add a .gitlab-ci-local-variables.yml file to the current working directory or a .env file in $HOME/.gitlab-ci-local..

Thanks in advance!

This is frequently confused, and you are not the first to be confused with it...

(i highly suspect it's because of the key word dotenv / env😅)


This https://github.com/firecow/gitlab-ci-local?tab=readme-ov-file#dotenv-file section of the docs is referring to the following
image

For what you are trying to do, they're actually documented under:
https://github.com/firecow/gitlab-ci-local?tab=readme-ov-file#home-file-variables
https://github.com/firecow/gitlab-ci-local?tab=readme-ov-file#project-file-variables

Hopefully this is clearer now. Feel free to add comment to https://github.com/firecow/gitlab-ci-local/tree/doc/readme?tab=readme-ov-file#via-a-file if you feel there's anywhere that it can be phrased better

fixed in #1434

Sorry for reopening this issue again, but I am still struggling to assign variable gitlab-ci-local

My yml file has something like this:

  rules:
    - if: '$CI_COMMIT_BRANCH == "develop"'

And I created the .gitlab-ci-local-env on root level of my project next to .gitlab-ci.yml

.gitlab-ci-local-env contains a value CI_COMMIT_BRANCH=develop, but gitlab-ci-local still cannot read this variable.

Please help with this challenge.

Sorry for reopening this issue again, but I am still struggling to assign variable gitlab-ci-local

My yml file has something like this:

  rules:
    - if: '$CI_COMMIT_BRANCH == "develop"'

And I created the .gitlab-ci-local-env on root level of my project next to .gitlab-ci.yml

.gitlab-ci-local-env contains a value CI_COMMIT_BRANCH=develop, but gitlab-ci-local still cannot read this variable.

Please help with this challenge.

I figured it out with this command:
gitlab-ci-local --variables-file .gitlab-ci-local-env

I had to explicitly set the path of the file.

it's a little confusing ...

Could you re-read this section of the docs ?

image

to do what you're trying to do, the default file is .gitlab-ci-local-variables.yml not .gitlab-ci-local-env