We are using Azure Pipeline to run Python integration tests.
These tests make use of a database, and the login information is saved in an Azure variable group that also contains secret variables.
The integration tests are started in this section of the yaml file:
jobs:
- job: IntegrationTests
variables:
- group: <some_variable_group>
- script: |
pdm run pytest \
--variables "$VARIABLE_FILE" \
--test-run-title="$TEST_TITLE" \
--napoleon-docstrings \
--doctest-modules \
--color=yes \
--junitxml=junit/test-results.xml \
integration
env:
DB_USER: $(SMDB_USER)
DB_PASSWORD: $(SMDB_PASSWORD)
DB_HOST: $(SMDB_HOST)
DB_DATABASE: $(SMDB_DATABASE)
The issue is that because SMDB PASSWORD is a secret variable, we are unable to read its value. It is advised to use arguments in a PythonScript task (like here: Passing arguments to python script in Azure Devops) in order to use the secret variables, but I am unsure of how to change this script to define PythonScript since it uses pdm.