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

Auto activate virtualenv in evergreen.yml

    XMLWordPrintable

    Details

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

      Description

      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 \
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: