Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Rename example for env file #1433

Closed
gbmd opened this issue Nov 20, 2024 · 5 comments
Closed

Documentation: Rename example for env file #1433

gbmd opened this issue Nov 20, 2024 · 5 comments

Comments

@gbmd
Copy link

gbmd commented Nov 20, 2024

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!

@ANGkeith
Copy link
Collaborator

ANGkeith commented Nov 20, 2024

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

@ANGkeith
Copy link
Collaborator

fixed in #1434

@Momen-Mawad
Copy link

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.

@Momen-Mawad
Copy link

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.

@ANGkeith
Copy link
Collaborator

ANGkeith commented Dec 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants