Skip to content

Commit c5a2192

Browse files
committed
Fix editable install: add --no-build-isolation; add lab cert retrieval for e2e tests
1 parent b9f2f59 commit c5a2192

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# template-install-lab-cert.yml
2+
#
3+
# Retrieves the MSID Lab authentication certificate from Key Vault and writes
4+
# it to disk as a PFX file, then exposes the path as a pipeline variable so
5+
# the test step can pass it via LAB_APP_CLIENT_CERT_PFX_PATH.
6+
#
7+
# Prerequisites (one-time ADO setup):
8+
# - Service connection 'AuthSdkResourceManager' must exist in the project and
9+
# have 'Get' and 'List' access to the 'msidlabs' Key Vault.
10+
# - Pipeline variable 'LAB_APP_CLIENT_ID' must be set on the pipeline
11+
# (ADO UI: Pipelines -> MSAL-Python Publish -> Edit -> Variables).
12+
#
13+
# The 'LabAuth' secret in msidlabs Key Vault is a base64-encoded PFX
14+
# certificate used to authenticate to both the msidlabs and id4skeyvault
15+
# Key Vaults during e2e tests.
16+
17+
steps:
18+
- task: AzureKeyVault@2
19+
displayName: 'Retrieve lab certificate from Key Vault'
20+
inputs:
21+
azureSubscription: 'AuthSdkResourceManager'
22+
KeyVaultName: 'msidlabs'
23+
SecretsFilter: 'LabAuth'
24+
RunAsPreJob: false
25+
26+
- bash: |
27+
set -euo pipefail
28+
CERT_PATH="$(Build.SourcesDirectory)/lab-auth.pfx"
29+
printf '%s' "$(LabAuth)" | base64 -d > "$CERT_PATH"
30+
echo "##vso[task.setvariable variable=LAB_APP_CLIENT_CERT_PFX_PATH]$CERT_PATH"
31+
echo "Lab cert written to: $CERT_PATH ($(wc -c < "$CERT_PATH") bytes)"
32+
displayName: 'Write lab certificate to disk'

.Pipelines/template-run-tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
# - template: .Pipelines/template-run-tests.yml
1111

1212
steps:
13+
# Retrieve the MSID Lab certificate used by e2e tests to authenticate to
14+
# msidlabs and id4skeyvault Key Vaults. Sets LAB_APP_CLIENT_CERT_PFX_PATH.
15+
- template: template-install-lab-cert.yml
16+
1317
- task: UsePythonVersion@0
1418
inputs:
1519
versionSpec: '$(python.version)'
@@ -18,7 +22,7 @@ steps:
1822
- script: |
1923
python -m pip install --upgrade pip
2024
grep -v '^-e' requirements.txt | pip install -r /dev/stdin
21-
pip install -e . --no-deps
25+
pip install -e . --no-deps --no-build-isolation
2226
displayName: 'Install dependencies'
2327

2428
# Use bash: (not script:) so set -o pipefail works — script: uses /bin/sh on Linux
@@ -29,6 +33,9 @@ steps:
2933
set -o pipefail
3034
pytest -vv --junitxml=test-results/junit.xml 2>&1 | tee test-results/pytest.log
3135
displayName: 'Run tests'
36+
env:
37+
LAB_APP_CLIENT_ID: $(LAB_APP_CLIENT_ID)
38+
LAB_APP_CLIENT_CERT_PFX_PATH: $(LAB_APP_CLIENT_CERT_PFX_PATH)
3239

3340
- task: PublishTestResults@2
3441
displayName: 'Publish test results'

0 commit comments

Comments
 (0)