pythonshellpytestjenkins-docker

Virtual environment does not open when executing shell script in Jenkins docker container


To run my python tests I created a freestyle project in Jenkins and wrote a script like this:

. .env/bin/activate
   pip install pytest
pytest --alluredir='FINAL/ws/allure-results' ./FINAL/autotests

But the build crashes with the "Can't open" error: "Can't open" error:


Solution

  • You can try by adding #!/bin/bash in the first line of the script step and then try to execute.