Skip to content

Update Azure Pipelines release pipeline with ESRP support#908

Open
mjcheetham wants to merge 5 commits intovfs-2.53.0from
azp
Open

Update Azure Pipelines release pipeline with ESRP support#908
mjcheetham wants to merge 5 commits intovfs-2.53.0from
azp

Conversation

@mjcheetham
Copy link
Copy Markdown
Member

Flesh out release pipeline with ESRP code signing

This series builds on the stub release pipeline added in 4b88e15 to create a working build + sign + release flow for Windows, macOS, and Linux.

What this does

Pipeline infrastructure (167cf79692)

  • Adds poolArch to matrix entries for correct hostArchitecture on arm64 hosted agents
  • Converts macOS from a single hardcoded job to a matrix parameter, matching Windows/Linux
  • Adds resolve-version.sh to derive version/tag info from the repo state
  • Adds setup-git-bash.cmd to put Git Bash on PATH for Windows agents
  • Wires up macOS validation jobs and artifacts in the release stage

ESRP code signing (406d385f6e)

  • Adds ESRP signing gated behind an esrp boolean parameter (default: false)
  • Windows uses a custom script (esrpsign.sh) so we can later integrate with the git signtool alias from Git for Windows' build process
  • Setup uses AzureCLI@2 with addSpnToEnvironment to resolve the WIF service connection by name — no hardcoded GUIDs in YAML
  • macOS/Linux use EsrpCodeSigning@6 via a reusable sign.yml template with archive support for macOS

Prerequisite installs (b1ea20f4c2, 9749c3979e)

  • Installs .NET SDK on Linux agents (required by the ESRP ADO task)
  • Installs Azure CLI on arm64 Windows agents (workaround until the hosted pool image includes it)

Files

File Description
release.yml Main pipeline — parameters, matrix, build/sign/release stages
scripts/resolve-version.sh Derives version + tag from HEAD
scripts/windows/setup-git-bash.cmd Prepends Git Bash to PATH
esrp/windows/setup.yml Installs ESRP client, generates auth JSON via AzureCLI@2
esrp/windows/esrpsign.sh Invokes ESRPClient.exe for Authenticode signing
esrp/sign.yml Reusable EsrpCodeSigning@6 wrapper with archive support

Testing

The esrp parameter defaults to false. Enable it in a pipeline run to test signing. The TO-DROP commit at the top overrides version resolution with a static value for testing; drop it before merging.

The stub release pipeline added in 4b88e15 had placeholder steps
and was missing several pieces needed for real builds. Flesh it out:

 - Add poolArch to the Windows and Linux matrix entries so we can set
   hostArchitecture on the pool, which is required for the arm64
   hosted agents to get the correct image.

 - Convert macOS from a single hardcoded job to a matrix parameter,
   matching the pattern used by Windows and Linux. This makes it easy
   to add additional macOS configurations in the future.

 - Add a resolve-version.sh script that derives the Git version,
   tag name, and tag SHA from the repository state. The prereqs
   stage currently inlines a static placeholder; the script is
   provided for when we are ready to switch.

 - Add a setup-git-bash.cmd script that prepends Git Bash to the
   PATH on Windows agents, so that subsequent Bash tasks can find
   the shell.

 - Add checkout with fetchDepth: 0 and fetchTags: true to the
   prereqs stage so the version resolution script can inspect tags.

 - Add macOS validation jobs to the release stage, and wire up macOS
   artifacts in the GitHub release publishing job.

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Add ESRP code signing support to the release pipeline, gated behind
an 'esrp' boolean parameter that defaults to false for now.

The Windows signing flow uses a custom script (esrpsign.sh) rather
than the EsrpCodeSigning ADO task so that we can later integrate
signing with the 'git signtool' alias from Git for Windows' build
process. The setup template uses AzureCLI@2 to bind to the WIF
service connection by name (avoiding hardcoded GUIDs) and derives
the service principal ID, tenant ID, and connection GUID at runtime
via addSpnToEnvironment and ENDPOINT_URL_* env vars. EsrpClientTool@4
handles downloading and caching the ESRP client binary.

For macOS and Linux, we use the EsrpCodeSigning@6 ADO task through a
reusable sign.yml template. On macOS, files must be submitted as a
zip archive (useArchive: true); the template handles the copy, zip,
sign, and extract cycle.

New files:
 - esrp/windows/setup.yml: installs ESRP client and generates the
   auth JSON needed by ESRPClient.exe
 - esrp/windows/esrpsign.sh: invokes ESRPClient.exe with Authenticode
   signing operations
 - esrp/sign.yml: reusable step template wrapping EsrpCodeSigning@6
   with optional archive support for macOS

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
The Linux hosted agents do not have .NET pre-installed, but the
EsrpCodeSigning ADO task requires it. Add a UseDotNet@2 step to
install the .NET 8 SDK before invoking the ESRP signing template
in Linux build jobs.

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
The arm64 Windows hosted agents do not have Azure CLI pre-installed,
which is required by the AzureCLI@2 task used in the ESRP setup
step. Install the x64 MSI (which runs under x86-64 emulation on
arm64 Windows) and prepend it to the PATH. This step only runs on
arm64 jobs via a poolArch condition.

This is a workaround until a bug preventing us from baking the Azure
CLI into the hosted pool image is fixed, at which point this step can
be removed.

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
@mjcheetham mjcheetham requested a review from dscho April 30, 2026 11:50
@mjcheetham
Copy link
Copy Markdown
Member Author

For Microsoft employees, here's an example run of this pipeline: https://dev.azure.com/mseng/1ES/_build/results?buildId=31429071

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant