Following is how my pipeline yaml file looks like.
definitions:
step:
- step: &GenerateExe
name: Generate Exe
runs-on:
- self.hosted
- windows
script:
- git config --global core.autocrlf input
- git config --global --add safe.directory '*'
- git lfs pull
- mkvirtualenv temp_py310
- workon temp_py310
- python -m pip list
- python -m pip install -r requirements.txt
- python -m pip list
- python generate_versions_rc.py
- pyinstaller --log-level=DEBUG MYEXE.spec
- rmvirtualenv temp_py310
artifacts:
- dist/**
after-script:
- rmvirtualenv temp_py310
pipelines:
default:
- step: *GenerateExe
It looks like each individual step is a different "powershell" command or script. I want to run the python commands from inside the virtual environment called "temp_py310". Are there better methods available in the bitbucket to do the same?
Something similar to WithENV(Pipeline: Basic Steps) in jenkins.
To ensure your Python steps run within the virtual environment (temp_py310), you should activate it explicitly before running your Python commands. In a Windows runner, if you’re using virtualenv, the activation is typically done using:
script:
- python -m venv temp_py310
- call temp_py310\Scripts\activate
- python -m pip install -r requirements.txt
- python generate_versions_rc.py
- pyinstaller --log-level=DEBUG MYEXE.spec
If you want something like withEnv from Jenkins, grouping everything under a single step is the closest option in Bitbucket Pipelines.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.