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

Auto activate virtualenv in evergreen.yml

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.7.2
    • Component/s: Testing Infrastructure
    • Labels:
      None

      Prevent Python from being invoked without activating virtualenv first.

         - command: expansions.update
           params:
             updates:
      -      - key: activate_virtualenv
      +      - key: python
               value: |
                 # check if virtualenv is set up
      -          if [ -d "${workdir}/venv" ]; then
      +          if [ -d "${workdir}/venv" ] && [ -z $IN_VIRTUAL_ENV ]; then
                   if [ "Windows_NT" = "$OS" ]; then
                     # Need to quote the path on Windows to preserve the separator.
                     . "${workdir}/venv/Scripts/activate" 2> /tmp/activate_error.log
      @@ -1805,10 +1776,12 @@ pre:
                     echo "Failed to activate virtualenv: $(cat /tmp/activate_error.log)"
                   fi
                   python=python
      -          else
      +            IN_VIRTUAL_ENV=1
      +            echo "python set to $python"
      +          elif [ -z $python ]; then
                   python=${python|/opt/mongodbtoolchain/v2/bin/python2}
                 fi
      -          echo "python set to $(which python)"
      +          $python \
      

            Assignee:
            backlog-server-tig DO NOT USE - Backlog - Test Infrastructure Group (TIG)
            Reporter:
            robert.guo@mongodb.com Robert Guo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: