-
Notifications
You must be signed in to change notification settings - Fork 211
Add ADO publish pipeline for PyPI releases #890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
18e024d
71abd77
360532b
302e9de
90fcfd0
8771d61
48d84f8
b9f2f59
c5a2192
4b3fbd2
bfb65a0
d03e0f7
3b78d35
a55942d
af6ec92
7ec5fb3
d342947
e171362
5460165
364eb7d
7bb5ecc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,243 @@ | ||||||||||
| # ADO Pipeline Setup Guide — MSAL Python → PyPI | ||||||||||
|
|
||||||||||
| This document describes every step needed to create an Azure DevOps (ADO) | ||||||||||
| pipeline that checks out the GitHub repo, runs tests, builds distributions, | ||||||||||
| and publishes to test.pypi.org (via the MSAL-Python environment) and PyPI. | ||||||||||
|
|
||||||||||
| The `.Pipelines/` folder follows the same template convention as [MSAL.NET](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/tree/main/build): | ||||||||||
|
|
||||||||||
| | File | Purpose | | ||||||||||
| |------|---------| | ||||||||||
| | [`pipeline-publish.yml`](pipeline-publish.yml) | Thin top-level wrapper — triggers, parameters, calls `template-pipeline-stages.yml` with `runPublish: true` | | ||||||||||
| | [`template-pipeline-stages.yml`](template-pipeline-stages.yml) | Shared stages template — Validate, CI, Build, Publish stages; reusable by PR-gate and post-merge CI pipelines | | ||||||||||
| | [`credscan-exclusion.json`](credscan-exclusion.json) | CredScan suppression file — suppresses known false positives for test fixture files (`certificate-with-password.pfx`, `test_mi.py`) | | ||||||||||
|
|
||||||||||
| --- | ||||||||||
|
|
||||||||||
| ## Overview | ||||||||||
|
|
||||||||||
| This pipeline is **manually triggered only** — no automatic branch or tag triggers. | ||||||||||
| Every publish requires explicitly entering a version and selecting a destination. | ||||||||||
|
|
||||||||||
| | Stage | Trigger | Target | | ||||||||||
| |-------|---------|--------| | ||||||||||
| | **PreBuildCheck** (PoliCheck + CredScan) | always | SDL security scans | | ||||||||||
| | **Validate** | release runs only (`runPublish: true`) | asserts `packageVersion` matches `msal/sku.py` | | ||||||||||
| | **CI** (tests on Py 3.9–3.14) | after Validate (or immediately on PR/merge runs) | — | | ||||||||||
| | **Build** (sdist + wheel) | after CI, release runs only | dist artifact | | ||||||||||
| | **PublishMSALPython** | `publishTarget = test.pypi.org (Preview / RC)` | test.pypi.org | | ||||||||||
| | **PublishPyPI** | `publishTarget = pypi.org (Production)` | PyPI (production) | | ||||||||||
|
Comment on lines
+22
to
+29
|
||||||||||
|
|
||||||||||
| --- | ||||||||||
|
|
||||||||||
| ## Step 1 — Prerequisites | ||||||||||
|
|
||||||||||
| | Requirement | Notes | | ||||||||||
| |-------------|-------| | ||||||||||
| | ADO Organization | [Create one](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization) if you don't have one | | ||||||||||
| | ADO Project | Under the org; enable **Pipelines** and **Artifacts** | | ||||||||||
| | [Secure Development Tools](https://marketplace.visualstudio.com/items?itemName=securedevelopmentteam.vss-secure-development-tools) extension | Must be installed in the ADO organization — required for the PreBuildCheck stage (PoliCheck, CredScan, PostAnalysis tasks) | | ||||||||||
| | GitHub account with admin rights | Needed to authorize the ADO GitHub App | | ||||||||||
| | PyPI API token | Scoped to the `msal` project — generate at <https://pypi.org/manage/account/token/> | | ||||||||||
| | MSAL-Python (test.pypi.org) API token | Scoped to the `msal` project on test.pypi.org | | ||||||||||
|
||||||||||
| | MSAL-Python (test.pypi.org) API token | Scoped to the `msal` project on test.pypi.org | | |
| | MSAL-Python (test.pypi.org) API token | Scoped to the `msal` project on test.pypi.org | | |
| | Azure service connection `AuthSdkResourceManager` | Azure Resource Manager service connection with access to the subscription / resource group that contains the Key Vault used by the pipeline. The service principal behind this connection must have at least **Get** permission on **secrets** in that Key Vault. This connection name is referenced by the `AzureKeyVault@2` task in `template-pipeline-stages.yml`. | | |
| | Key Vault secret `LabAuth` | In the Key Vault referenced by `template-pipeline-stages.yml`, create a secret named `LabAuth` containing the lab authentication credentials required by the CI stage. The `AuthSdkResourceManager` service connection must be able to read this secret for the pipeline to succeed. | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "tool": "Credential Scanner", | ||
| "suppressions": [ | ||
| { | ||
| "file": "certificate-with-password.pfx", | ||
| "_justification": "Self-signed certificate used only in unit tests. Not a production credential." | ||
| }, | ||
| { | ||
| "file": "test_mi.py", | ||
| "_justification": "WWW-Authenticate challenge header value used as a mock HTTP response fixture in unit tests. Not a real credential." | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # pipeline-publish.yml | ||
| # | ||
| # Release pipeline for the msal Python package — manually triggered only. | ||
| # Source: https://github.com/AzureAD/microsoft-authentication-library-for-python | ||
| # | ||
| # Delegates all stages to template-pipeline-stages.yml, which is shared with | ||
| # the (future) PR gate and post-merge CI pipelines. | ||
| # For one-time ADO setup, see ADO-PUBLISH-SETUP.md. | ||
|
|
||
| parameters: | ||
| - name: packageVersion | ||
| displayName: 'Package version to publish (must match msal/sku.py, e.g. 1.36.0 or 1.36.0rc1)' | ||
| type: string | ||
|
|
||
| - name: publishTarget | ||
| displayName: 'Publish target' | ||
| type: string | ||
| values: | ||
| - 'test.pypi.org (Preview / RC)' | ||
| - 'pypi.org (Production)' | ||
|
|
||
| trigger: none # manual runs only — no automatic branch or tag triggers | ||
| pr: none | ||
|
|
||
| stages: | ||
| - template: template-pipeline-stages.yml | ||
| parameters: | ||
| packageVersion: ${{ parameters.packageVersion }} | ||
| publishTarget: ${{ parameters.publishTarget }} | ||
| runPublish: true |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THerea are 3 sceanrios:
In MSAL.NET I believe these are all 1 pipeline, whith optional config.