-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: CI
-
None
This ticket was split from DRIVERS-2702, please see that ticket for a detailed description.
AC
- Drivers should perform the steps provided by the evergreen team to audit their configs and test the change ahead of its deployment. Specifically, check each task that defines more than one `func:`. If `vars:` are set in any `func:` other than the last one, check the subsequent `func:` definitions/scripts for reliance on `vars:` defined in the preceding functions.
- It is NOT sufficient to look for failures after enabling the feature flag for the fix as the variable could have a different value defined outside the function scope that causes a change in behavior and not an outright build failure.
- Repos
- mongodb/node-mongodb-native
- mongodb/js-bson
- mongodb-js/bson-ext (review configs)
- mongodb-js/kerberos
- mongodb/libmongocrypt bindings/node directory
- Branches
- All: main/master
- Additionally for driver and js-bson: 5.x, 4.x, 3.7
The following is copied from the relevant comment on EVG-20276:
As promised, we’ve introduced a way to test unsetting function vars before rolling it out for everyone. To do so, please set unset_function_vars: true at the top of your project config (example).
For those who wish to audit their project configs in advance, here are some tips:
- After setting unset_function_vars to true, run all tasks in the project and look out for anything that passed on main but is now failing, or anything that seems to be behaving in an unexpected way. If the test does not behave as expected, it is likely indicative of the task relying on a function var outside of that function’s. As an example, this project config was run with and without setting unset_function_vars.When unset_functin_vars is set to true, the value of foo is undefined when referenced outside of the function scope. However, when unset_function_vars isn’t set, which represents the current behavior, the value of foo is defined outside of the function scope.
- If you notice an instance of a function var being used outside of the function scope in your project, consider using an expansion instead to set the key value pair so that they are available either on a build variant or project wide level. If you need the value to be set during runtime, you can use expansions.update.
- If a function var and an expansion share a key name, tests can fall back on the expansion value instead of encountering an undefined variable.
- I’d recommend looking for any function vars that share a key name with expansions, and making them unique before testing.
- If there are any other fallbacks explicitly programmed in any scripts run by tasks for when a function var is not defined, remove them when testing.
If anyone wishes to preserve the current behavior, either because it’s desired for a use case or because more time is needed to fix it, the old behavior can be preserved by simply calling expansions.update at the end of every function with the key value pairs of the vars you want to persist.
For example, this project config has foo defined as a function var and then calls expansions.update to save the current function value ${foo} as an expansion. As you can see by the echos in this example, despite unset_function_vars being set to true, it behaved in a manner consistent with the current behavior and the function vars continued to be defined after the function exited. The output is the same as in this patch where unset_function_vars was not set.
If you have any questions, please reach out to us in #evergreen-users.
- is duplicated by
-
NODE-5485 Add relevant environment data to expansions in evergreen
- Closed
-
NODE-5486 [v4.x BACKPORT] Add relevant environment data to expansions in evergreen
- Closed
-
NODE-5487 [v5.x BACKPORT] Add relevant environment data to expansions in evergreen
- Closed
- split from
-
DRIVERS-2702 Audit and update evergreen CI config var scopes by Oct 6
- Closed