-
Notifications
You must be signed in to change notification settings - Fork 273
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
fix: re-initialize providers changing environments #3481
Conversation
28529eb
to
69afab8
Compare
When users change environments, we need to re-initialize providers. Let's consider the following example: User has a provider config like so: ``` providers: - name: exec initScript: echo ${environment.name} > someFile ``` If user runs a garden command with --env foo, and then with --env bar, and then again with --env foo we would expect `someFile` to contain `foo`. But the file actually contains bar. Reason for this is that garden skipped executing the initScript in the foo env, because it has already been executed. But the cache logic is not aware that the last command that ran was in the bar env. This commit fixes that problem. co-authored-by: srihas-g <[email protected]>
69afab8
to
dbf2df4
Compare
Reasoning is that when the env name changes and that is relevant, the provider config changes too (assuming that we do not implicitly pass additional information like the environment name using env variables)
654fbd0
to
bc1372c
Compare
co-authored-by: Walther <[email protected]>
bc1372c
to
d0032f0
Compare
005af72
to
f8cbe7a
Compare
I wonder if the new test will just run on circleci, or if I have to change the circleci yaml to include the new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! The integ test is very easy to understand.
The integ test should just run, along with the rest of the integ test suite. You should be able to confirm by looking at the vm test logs. |
* fix: re-initialize providers changing environments When users change environments, we need to re-initialize providers. Let's consider the following example: User has a provider config like so: ``` providers: - name: exec initScript: echo ${environment.name} > someFile ``` If user runs a garden command with --env foo, and then with --env bar, and then again with --env foo we would expect `someFile` to contain `foo`. But the file actually contains bar. Reason for this is that garden skipped executing the initScript in the foo env, because it has already been executed. But the cache logic is not aware that the last command that ran was in the bar env. This commit fixes that problem. * improvement: remove unnecessary check for env name Reasoning is that when the env name changes and that is relevant, the provider config changes too (assuming that we do not implicitly pass additional information like the environment name using env variables) * tests: add an integration test Co-authored-by: srihas-g <[email protected]> Co-authored-by: Walther <[email protected]>
* fix: re-initialize providers changing environments When users change environments, we need to re-initialize providers. Let's consider the following example: User has a provider config like so: ``` providers: - name: exec initScript: echo ${environment.name} > someFile ``` If user runs a garden command with --env foo, and then with --env bar, and then again with --env foo we would expect `someFile` to contain `foo`. But the file actually contains bar. Reason for this is that garden skipped executing the initScript in the foo env, because it has already been executed. But the cache logic is not aware that the last command that ran was in the bar env. This commit fixes that problem. * improvement: remove unnecessary check for env name Reasoning is that when the env name changes and that is relevant, the provider config changes too (assuming that we do not implicitly pass additional information like the environment name using env variables) * tests: add an integration test Co-authored-by: srihas-g <[email protected]> Co-authored-by: Walther <[email protected]>
When users change environments, we need to re-initialize providers.
Let's consider the following example:
User has a provider config like so:
If user runs a garden command with --env foo, and then with --env bar,
and then again with --env foo we would expect
someFile
to containfoo
. Butthe file actually contains bar.
Reason for this is that garden skipped executing the initScript in the foo env,
because it has already been executed. But the cache logic is not aware that the
last command that ran was in the bar env.
This commit fixes that problem.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: