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

Change .circleci home directory location with an Environment variable #1007

Open
kferrone opened this issue Sep 20, 2023 · 4 comments
Open
Assignees

Comments

@kferrone
Copy link

What problem does this feature solve?:

Multiple customers using circle ci with multiple users in source vcs and therefore multiple personal access tokens. Currently I have to change the token manually within ~/.circleci/cli.yml to be able to switch context between customers. Then in each customer workspace will have it's own circleci context with it's own tokens.

Provide an example:

Set a variable like CIRCLECI_HOME. to point to the .circleci directory created when you run the setup.

@JulesFaucherre
Copy link
Contributor

JulesFaucherre commented Sep 21, 2023

Hello @kferrone , thanks for raising the issue!

Actually config location and even config customisation overall is a subject we discussed a lot in our team. Our aim in the (hopefully near) future would be to enable users to have several level of configuration.
Say you have

  • A
    • .circleci/cli.yml
    • B
      • .circleci/cli.yml
      • ...other files / directories in B

The CLI would first load the config in A and then the config in B thus overwriting the values set in A.

While we implement this, I propose that we add a root option --config that would allow you to specify the path of the directory to load config from.

@kferrone
Copy link
Author

kferrone commented Sep 21, 2023

Please consider allowing to move the directory. I have many customers each with a workspace which has a .envrc file to scope into their context. This way all tools are configured to treat that directory as the HOME directory for that project.

Having any tool try and stuff every single customer config into a single place will get very overwhelming very quickly. We even have some customers with more than one CircleCI account for whatever reason. Imagine how large the .circleci dir will get for us.

Every single CLI we currently use, except circlecli, allows changing where the home directory is. For example with aws cli I can set AWS_CONFIG_FILE and k8s with KUBECONFIG. This keeps everything very nicely organized and all customer stuff is in one single location.

Then cd into customer folder and direnv loads .envrc and voila, all cli tools just magically use the correct accounts and there is no chance of accidentally running commands against wrong customer.

I suggest something simple as CIRCLECI_CONFIG to be like everything else. Or CIRCLECI_HOME since it is a directory.

@JulesFaucherre JulesFaucherre self-assigned this Oct 9, 2023
@kferrone
Copy link
Author

Any chance this is going to happen. One cli.yml is becoming a burden.

@ngdangtu-vn
Copy link

I usually try to keep all the config in .config/ directory. This helps me easily backup my machine quickly with git. On the other hand, I also keep bin file in .local/bin so it would be great if we can have this option

I suggest something simple as CIRCLECI_CONFIG to be like everything else. Or CIRCLECI_HOME since it is a directory.

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