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

[BUG] Race condition in doppler setup when applying settings in more than one project #403

Open
gregdan3 opened this issue Jun 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@gregdan3
Copy link

gregdan3 commented Jun 6, 2023

Describe the bug
If you run doppler setup in two or more projects at once, they will open the user's doppler config ~/.doppler/.doppler.yaml at the same time and apply their changes to the same copy of the file, resulting in only one of the changes applying. This might occur if the user batches changes across several projects with doppler setup --no-interactive.

To Reproduce

  1. Set up two or more directories with a doppler.yaml
  2. Execute the following in the parent directory of those two:
parallel "cd {} && doppler setup --no-interactive --debug" ::: *
  1. Check doppler configure in any of the projects, observing that one of the projects has a project and config in its configure, but the others do not
  2. Check ~/.doppler/.doppler.yaml to confirm the same

Example of this occurring:

~/example ❯ parallel "cd {} && doppler setup --no-interactive --debug" ::: *
Auto-selecting project from repo config file
Auto-selecting config from repo config file
┌─────────┬────────┬──────────────────────────────────┐
│ NAME    │ VALUE  │ SCOPE                            │
├─────────┼────────┼──────────────────────────────────┤
│ config  │ prd    │ /home/gregdan3/example/project_2 │
│ project │ common │ /home/gregdan3/example/project_2 │
└─────────┴────────┴──────────────────────────────────┘
Debug: Using config dir /home/gregdan3/.doppler
Debug: Using config file /home/gregdan3/.doppler/.doppler.yaml
Debug: Reading config file
Debug: Reading repo config file doppler.yaml
Debug: Sending anonymous analytics payload: '{"command":"doppler.setup"}'
Debug: Performing HTTP POST to https://cli.doppler.com/v1/analytics
Debug: Writing user config to /home/gregdan3/.doppler/.doppler.yaml
Debug: Writing to temp file /home/gregdan3/.doppler/.doppler.yaml.Q5xDAKWw
Debug: Renaming temp file to /home/gregdan3/.doppler/.doppler.yaml
Auto-selecting project from repo config file
Auto-selecting config from repo config file
┌─────────┬────────┬──────────────────────────────────┐
│ NAME    │ VALUE  │ SCOPE                            │
├─────────┼────────┼──────────────────────────────────┤
│ config  │ prd    │ /home/gregdan3/example/project_1 │
│ project │ common │ /home/gregdan3/example/project_1 │
└─────────┴────────┴──────────────────────────────────┘
Debug: Using config dir /home/gregdan3/.doppler
Debug: Using config file /home/gregdan3/.doppler/.doppler.yaml
Debug: Reading config file
Debug: Reading repo config file doppler.yaml
Debug: Sending anonymous analytics payload: '{"command":"doppler.setup"}'
Debug: Performing HTTP POST to https://cli.doppler.com/v1/analytics
Debug: Writing user config to /home/gregdan3/.doppler/.doppler.yaml
Debug: Writing to temp file /home/gregdan3/.doppler/.doppler.yaml.5QZbeO6Y
Debug: Renaming temp file to /home/gregdan3/.doppler/.doppler.yaml

Expected behavior
Doppler should keep track of a lockfile so the config file can only be read and written to by one process at a time.

Desktop (please complete the following information):

  • OS: Archlinux
  • Version 6.3.4-arch2-1
  • uname --all: Linux ilo 6.3.4-arch2-1 #1 SMP PREEMPT_DYNAMIC Mon, 29 May 2023 13:58:34 +0000 x86_64 GNU/Linux

CLI Version:
Version v3.60.1

Additional context
Feel free to let me know if this a harebrained activity that doesn't need fixing- for the time being we'll be working around this by dispatching setup commands consecutively rather than simultaneously anyway.

@gregdan3 gregdan3 added the bug Something isn't working label Jun 6, 2023
@watsonian
Copy link
Contributor

@gregdan3 Thanks for reporting this! We'll take a look at it. In the mean time though, one thing you might consider is taking advantage of the monorepo-friendly setup file format we introduced in #394. Essentially, in your example, you could add a single doppler.yaml file in your /home/gregdan3/example directory. The contents of that file might look something like this:

setup:
  - project: common
    config: prd
    path: project_1/
  - project: common
    config: prd
    path: project_2/

You then just need to run something along the lines of doppler setup --no-interactive from the root directory and it'll setup all the subdirectories you configure in the setup file.

Not a solution for the race condition, but perhaps a better way to accomplish what you're after in the mean time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants