Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5574

Audit and update evergreen CI config var scopes by Oct 6

    • 8
    • Hide

      DRIVERS-2702:
      All drivers must audit and update their CI configs for usages of vars in function scopes by October 6 at which point the changes in EVG-20276 will take effect causing vars defined in function scopes to no longer be retained in subsequent function executions.

      Please see DRIVERS-2702 for additional details.

      Show
      DRIVERS-2702 : All drivers must audit and update their CI configs for usages of vars in function scopes by October 6 at which point the changes in EVG-20276 will take effect causing vars defined in function scopes to no longer be retained in subsequent function executions. Please see DRIVERS-2702 for additional details.
    • Not Needed
    • Hide

      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.

      Show
      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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. 

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: