Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pre-release.yml: This should build from the `main` branch and publish to the Azu

devdiv-pre-release.yml: DevDiv replacement for the MonacoTools `pre-release.yml` pipeline. It has the same triggers, build matrix, version suffix, and `bin-<target>` artifacts. Like `pre-release.yml`, it only supplies parameters; the logic lives in `templates/rust-package.yml`, a DevDiv copy of `microsoft/vscode-engineering`'s `azure-pipelines/rust-package/pipeline.yml` that extends the MicroBuild 1ES template. Signing uses MicroBuild through `signing/sign.proj`: Windows `pet.exe` is signed with Microsoft400 in its build job, and all macOS `pet` binaries are signed with MacDeveloperHarden and notarized with 8020 in a single job. Linux binaries are not signed.

The DevDiv pipeline runs APIScan on the x64 Windows artifact and uploads results to TSA using `tsaoptions.json`. The `VSEng-APIScanSC` service connection must be authorized for the pipeline. Before disabling Monaco pipeline 591, merge this pipeline to `main`, set DevDiv definition 28980's default branch to `main`, verify a successful seven-target run, and migrate the Python Environments extension's pre-release consumer to the DevDiv artifacts.
After successful packaging, the DevDiv pipeline runs APIScan on the x64 Windows artifact and uploads results to TSA using `tsaoptions.json`. This stage runs for `main`, `release/*` branches, and release tags (`release/<year>.<build>` or the historical `v<year>.<build>.<patch>` format). PR and feature refs skip the stage even when queued manually; packaging is unchanged. The `VSEng-APIScanSC` service connection must be authorized for the pipeline. Before disabling Monaco pipeline 591, merge this pipeline to `main`, set DevDiv definition 28980's default branch to `main`, verify a successful seven-target run, and migrate the Python Environments extension's pre-release consumer to the DevDiv artifacts.

stable.yml: This builds tags matching `release/<year>.<build>`, where `<year>` is four digits and `<build>` is numeric, and publishes to the Azure Pipeline feed. The pipeline is triggered when a matching tag is pushed to GitHub. This will be consumed by extensions when publishing stable builds. Signing is required on this build.

Expand Down
8 changes: 8 additions & 0 deletions azure-pipelines/templates/rust-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ extends:
- checkout: self
path: s

- ${{ if eq(platform.target, 'x86_64-pc-windows-msvc') }}:
- pwsh: |
$scanRef = $env:BUILD_SOURCEBRANCH -cmatch '^refs/(?:heads/(?:main|release/.+)|tags/(?:release/[0-9]{4}\.[0-9]+|v[0-9]{4}\.[0-9]+\.[0-9]+))$'
Write-Host "##vso[task.setvariable variable=scanRef;isOutput=true]$scanRef"
name: classifySource
displayName: Check APIScan source ref

- ${{ parameters.preBuildSteps }}

- task: RustInstaller@1
Expand Down Expand Up @@ -390,6 +397,7 @@ extends:
- stage: APIScan
displayName: APIScan
dependsOn: Package
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(dependencies.Package.outputs['Package_x86_64_pc_windows_msvc.classifySource.scanRef'], 'True'))
variables:
# MicroBuild auto-injects a telemetry step that requires TeamName in every stage.
TeamName: ${{ parameters.teamName }}
Expand Down
23 changes: 23 additions & 0 deletions scripts/tests/test_azure_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,29 @@ def test_windows_notice_includes_unharvested_build_dependency(self):
self.assertIn('Copyright 2016 Max Resch', additional)
self.assertIn('Permission is hereby granted', additional)

def test_apiscan_source_ref_gate(self):
pattern = re.search(r"\$scanRef = \$env:BUILD_SOURCEBRANCH -cmatch '([^']+)'", self.template)
self.assertIsNotNone(pattern)
for ref, expected in (
('refs/heads/main', True),
('refs/heads/release/latest', True),
('refs/tags/release/2026.12', True),
('refs/tags/v2024.16.0', True),
('refs/pull/585/merge', False),
('refs/heads/devdiv-prerelease', False),
('refs/heads/feature/release/2026.12', False),
('refs/heads/Main', False),
('refs/tags/release/test', False),
('refs/tags/release/2026.12-preview', False),
('refs/tags/vnext', False),
):
with self.subTest(ref=ref):
self.assertEqual(bool(re.search(pattern[1], ref)), expected)

stage = self.template.split('- stage: APIScan\n', 1)[1].split('jobs:', 1)[0]
self.assertIn("condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), "
"eq(dependencies.Package.outputs['Package_x86_64_pc_windows_msvc.classifySource.scanRef'], 'True'))", stage)

def test_apiscan_uses_workload_identity_service_connection(self):
apiscan_start = self.template.index('- task: APIScan@2')
tsa_start = self.template.index('- task: TSAUpload@2', apiscan_start)
Expand Down
Loading