Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-80270

Test new evergreen function var behavior

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.3, 6.0.12
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • v7.0, v6.0, v5.0
    • 162

      Evergreen is making a change to how some variables can be set in the evergreen yaml. These changes will go into effect on Oct 6th and can be tested by setting{} `unset_function_vars: true` at the top of our project config. It is possible this introduces issues with out current configuration and we should at the very least look for obvious failures before the change happens.

      Original slack thread with context: https://mongodb.slack.com/archives/C0V896UV8/p1692628286890599?thread_ts=1691517624.121179&cid=C0V896UV8

       

      Original messages:
      Hi all,
      Due to a bug, vars defined in functions in the evergreen project config would persist after the function finished running. This work is tracked in EVG-20276.In the example below, foo should only be defined in the function itself and no longer be defined in the command that follows it.
      name: my-test
      commands:

      • func: func-name
        vars:
        foo: "bar"
      • command: shell.exec
        params:
        script: echo value of foo after the function ${foo}
        However, due to a bug it was still defined in the echo after the function finished running.We will be fixing it to stop persisting vars outside of functions. Please note that anything set using expansions.update will continue to persist for the entire task as promised in the docs, even if it’s used inside of a function.While we don’t normally send out announcements for bug fixes, we realize that some teams may have come to rely on this behavior, so we wanted to give everyone time to audit their configurations, if preferred. Please take a look at your project config to see if there are any instances where function vars are relied on outside of the function. A summary of potential scenarios and impacts can be found in the ticket linked above.We plan to deploy the fix for this bug on Wednesday September 6, __ and will have a rollback plan in place in the instance that this causes unforeseen complications. If you need more time or have any questions, please reach out here and let us know.
         
         
        follow up:
        I sent out an email extending the deadline to October 6, and explaining how to set unset_function_vars: true at the top of your project config to test this change. I included tips for what to look out for when auditing the yaml and testing.I also included instructions for what to do in the where somebody wants to preserve the current behavior for function vars.

        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.

            Assignee:
            trevor.guidry@mongodb.com Trevor Guidry
            Reporter:
            trevor.guidry@mongodb.com Trevor Guidry
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: