[release/v7.6.1] Correct Variable Template Reference in NonOfficial Pipeline Templates#27317
Conversation
…PowerShell#27275) Co-authored-by: Justin Chung <[email protected]>
There was a problem hiding this comment.
Pull request overview
Backports fixes to release/v7.6.1 to correct broken Azure DevOps YAML template references (primarily for NonOfficial pipelines) by standardizing on repo-root-anchored template paths.
Changes:
- Updated NonOfficial pipeline YAMLs to reference shared templates via absolute
/.pipelines/...@selfpaths. - Fixed an in-template include in
PowerShell-vPack-Stages.ymlto avoid incorrect relative resolution. - Updated the Split ADO Pipelines agent documentation to describe the intended template reference convention (and added a Windows host version pin in one NonOfficial pipeline).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| .pipelines/templates/stages/PowerShell-vPack-Stages.yml | Anchors SetVersionVariables.yml include to repo root to prevent path composition errors. |
| .pipelines/NonOfficial/PowerShell-vPack-NonOfficial.yml | Switches variables/stages template references to /.pipelines/...@self. |
| .pipelines/NonOfficial/PowerShell-Release-NonOfficial.yml | Switches variables/stages template references to /.pipelines/...@self. |
| .pipelines/NonOfficial/PowerShell-Release-Azure-NonOfficial.yml | Switches variables template reference to /.pipelines/...@self. |
| .pipelines/NonOfficial/PowerShell-Packages-NonOfficial.yml | Switches variables/stages template references to /.pipelines/...@self. |
| .pipelines/NonOfficial/PowerShell-Coordinated_Packages-NonOfficial.yml | Switches variables/stages template references to /.pipelines/...@self and adds WindowsHostVersion.Version: 2022. |
| .github/agents/SplitADOPipelines.agent.md | Updates guidance/examples to use .pipelines and absolute template references. |
| ## Template Reference Convention (MUST follow) | ||
|
|
||
| All `- template:` references to files **inside this repo** must use the **absolute** form anchored at the repo root, with the `@self` suffix: | ||
|
|
||
| ```yaml | ||
| - template: /.pipelines/templates/<path>/<file>.yml@self | ||
| ``` | ||
|
|
||
| Do **not** use relative paths such as `templates/...`, `../templates/...`, or bare filenames. Rationale: | ||
|
|
||
| - Absolute paths resolve identically regardless of where the referring file lives, so moving a pipeline file between directories (for example, into `.pipelines/NonOfficial/`) does not silently break includes. | ||
| - Relative paths are resolved by Azure DevOps against the directory of the referring file, which has caused real outages in this repo when a relative include was composed into a nonexistent nested path like `.pipelines/templates/stages/.pipelines/templates/...`. | ||
| - The majority of existing includes already use the absolute form; keeping new work consistent reduces review burden. | ||
|
|
||
| The only acceptable non-absolute references are to external repositories resolved via the `resources.repositories` block, for example `v2/OneBranch.Official.CrossPlat.yml@onebranchTemplates`. |
There was a problem hiding this comment.
The new guidance says all in-repo - template: references must use the absolute /.pipelines/...@self form and that relative/bare filenames are not acceptable. This isn’t currently true in this repo (e.g., .pipelines/templates/linux-package-build.yml and .pipelines/templates/mac-package-build.yml use - template: SetVersionVariables.yml@self and other relative includes). Please either (a) narrow the guidance to entrypoint pipeline YAMLs and templates expected to be referenced from multiple directories, or (b) update the existing templates to match the stated convention so the doc doesn’t mislead future changes.
| WindowsHostVersion: | ||
| Version: 2022 | ||
| Network: KS3 |
There was a problem hiding this comment.
This adds WindowsHostVersion.Version: 2022, which changes the build host selection (behavioral pipeline change) beyond the PR description’s claim of “straightforward path corrections with no logic modifications”. If this host version pin is required, please call it out in the PR description/testing notes (or drop it from this backport if it wasn’t intended).
Backport of #27275 to release/v7.6.1
Triggered by @adityapatwardhan on behalf of @jshigetomi
Original CL Label: CL-BuildPackaging
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Corrects broken template references in NonOfficial pipeline YAML files. These fixes are required for NonOfficial pipelines to execute properly in the 7.6.1 release branch.
Customer Impact
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
The fix corrects relative paths in NonOfficial pipeline YAML configuration files. Testing involves verifying that NonOfficial pipelines can be executed without template reference errors. Changes are straightforward path corrections with no logic modifications.
Risk
REQUIRED: Check exactly one box.
Changes affect CI/CD infrastructure (NonOfficial pipelines). However, these are straightforward relative path corrections with no behavioral changes to PowerShell itself. Risk is mitigated by the small scope of changes and clear fix rationale.