-
Notifications
You must be signed in to change notification settings - Fork 137
CHORE: add OneBranch build & package pipeline #548
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # ============================================================================= | ||
| # OneBranch Build & Package pipeline for mssql-django. | ||
| # ============================================================================= | ||
| # Builds the pure-Python package (sdist + universal wheel via `python -m build`), | ||
| # bundles the regex_clr.dll CLR assembly, generates an SBOM, and publishes the | ||
| # OneBranch 'drop' artifact consumed by the Official-Release and Dummy-Release | ||
| # pipelines. | ||
| # | ||
| # mssql-django is pure Python -> ONE universal wheel + sdist. There is no | ||
| # platform matrix, no native compilation, no symbols (unlike mssql-python). | ||
| # | ||
| # regex_clr.dll: fetched at build time with AUTHENTICATED access (AzureCLI + | ||
| # managed identity, `--auth-mode login`) from the private, network-restricted | ||
| # storage account -- NOT the old anonymous wget (public access is Disabled). | ||
| # The Django-1ES-pool is allow-listed on that storage account's network. | ||
| # | ||
| # Pipeline source = Azure DevOps mssql-django mirror (checkout: self), keeping | ||
| # the pipeline source ADO-only for SDL. | ||
| # ============================================================================= | ||
|
|
||
| name: $(Year:YY)$(DayOfYear)$(Rev:.r) | ||
|
|
||
| trigger: | ||
| branches: | ||
| include: | ||
| - main | ||
|
|
||
| pr: | ||
| branches: | ||
| include: | ||
| - main | ||
|
|
||
| schedules: | ||
| - cron: "0 21 * * *" # daily nightly build | ||
| displayName: Daily nightly build | ||
| branches: | ||
| include: | ||
| - main | ||
| always: true | ||
|
|
||
| variables: | ||
| - template: /OneBranchPipelines/variables/common-variables.yml@self | ||
| - template: /OneBranchPipelines/variables/onebranch-variables.yml@self | ||
|
|
||
| resources: | ||
| repositories: | ||
| - repository: templates | ||
| type: git | ||
| name: 'OneBranch.Pipelines/GovernedTemplates' | ||
| ref: 'refs/heads/main' | ||
|
|
||
| extends: | ||
| template: 'v2/OneBranch.Official.CrossPlat.yml@templates' | ||
| parameters: | ||
| globalSdl: | ||
| sbom: | ||
| enabled: true | ||
| credscan: | ||
| enabled: true | ||
| suppressionsFile: $(Build.SourcesDirectory)/.config/CredScanSuppressions.json | ||
| policheck: | ||
| break: true | ||
| tsa: | ||
| enabled: true | ||
| configFile: $(Build.SourcesDirectory)/.config/tsaoptions.json | ||
|
|
||
| stages: | ||
| - stage: build | ||
| displayName: 'Build mssql-django package' | ||
| jobs: | ||
| - job: build | ||
| displayName: 'Build sdist + wheel' | ||
|
|
||
| # Custom 1ES pool: allow-listed on the regex_clr storage network. | ||
| pool: | ||
| type: linux | ||
| isCustom: true | ||
| name: Django-1ES-pool | ||
| demands: | ||
| - imageOverride -equals Ubuntu22.04-AzurePipelines | ||
|
|
||
| variables: | ||
| # OneBranch auto-publishes this directory as the 'drop' artifact. | ||
| ob_outputDirectory: '$(Build.SourcesDirectory)/out' | ||
|
|
||
| steps: | ||
| - task: UsePythonVersion@0 | ||
| displayName: 'Use Python 3.x' | ||
| inputs: | ||
| versionSpec: '3.x' | ||
| addToPath: true | ||
|
|
||
| - task: PipAuthenticate@1 | ||
| displayName: 'Pip Authenticate' | ||
| inputs: | ||
| artifactFeeds: '$(PIP_FEED)' | ||
|
|
||
| - task: AzureCLI@2 | ||
| displayName: 'Fetch regex_clr.dll (authenticated, no anonymous wget)' | ||
| inputs: | ||
| azureSubscription: '$(RegexClrServiceConnection)' | ||
| scriptType: 'bash' | ||
| scriptLocation: 'inlineScript' | ||
| inlineScript: | | ||
| set -euo pipefail | ||
| az storage blob download \ | ||
| --account-name "$(REGEX_CLR_STORAGE_ACCOUNT)" \ | ||
| --container-name "$(REGEX_CLR_CONTAINER)" \ | ||
| --name "$(REGEX_CLR_BLOB)" \ | ||
| --file "$(Build.SourcesDirectory)/mssql/$(REGEX_CLR_BLOB)" \ | ||
| --auth-mode login | ||
| ls -la "$(Build.SourcesDirectory)/mssql/$(REGEX_CLR_BLOB)" | ||
|
|
||
| - task: Bash@3 | ||
| displayName: 'Build sdist + wheel' | ||
| inputs: | ||
| targetType: 'inline' | ||
| script: | | ||
| set -euo pipefail | ||
| cd "$(Build.SourcesDirectory)" | ||
| python -m pip install --upgrade pip build | ||
| python -m build | ||
| mkdir -p "$(Build.SourcesDirectory)/out" | ||
| cp -v "$(Build.SourcesDirectory)"/dist/* "$(Build.SourcesDirectory)/out/" | ||
| echo "=== packaged artifacts ===" | ||
| ls -la "$(Build.SourcesDirectory)/out" | ||
|
|
||
| - task: ManifestGeneratorTask@0 | ||
| displayName: 'Generate SBOM' | ||
| inputs: | ||
| BuildDropPath: '$(Build.SourcesDirectory)/out' | ||
| PackageName: '$(PACKAGE_NAME)' | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.