Skip to content

feat(compile): unify pool front-matter replacement across targets#538

Merged
jamesadevine merged 6 commits into
mainfrom
copilot/update-pool-frontmatter
May 14, 2026
Merged

feat(compile): unify pool front-matter replacement across targets#538
jamesadevine merged 6 commits into
mainfrom
copilot/update-pool-frontmatter

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

Summary

pool front matter was effectively self-hosted-only (name), which did not model Microsoft-hosted pools correctly for non-1ES targets. This change introduces explicit vmImage support and makes non-1ES default to vmImage: ubuntu-latest, while also unifying pool replacement behavior across all templates (including 1ES).

  • Pool schema + compile-time resolution

    • PoolConfig now supports name and vmImage in object form.
    • Non-1ES targets resolve pool to a single concrete line (name: or vmImage:).
    • Non-1ES default when omitted: vmImage: ubuntu-latest.
    • 1ES uses the same replacement path and resolves a pool block with name + os (defaulting to AZS-1ES-L-MMS-ubuntu-22.04 and linux).
    • pool.vmImage is rejected for target: 1es.
  • Template wiring

    • Renamed pool_block to pool and use {{ pool }} consistently across templates.
    • Non-1ES templates (base.yml, job-base.yml, stage-base.yml) now consume {{ pool }} under pool:.
    • 1ES template now also consumes {{ pool }} as a block under extends.parameters.pool.
  • Codemod

    • Added pool_object_form codemod for scalar syntax normalization.
    • pool: <string> is rewritten to explicit object form as:
      • pool: { name: <string> }
    • This includes legacy scalar values like:
      • pool: AZS-1ES-L-MMS-ubuntu-22.04pool: { name: AZS-1ES-L-MMS-ubuntu-22.04 }
  • Docs/tests updates

    • Updated front-matter and template-marker docs for unified {{ pool }} semantics and defaults.
    • Updated pool-related tests and added coverage for unified resolver behavior and codemod scalar-to-name-object normalization.
# non-1ES default (when pool is omitted)
pool:
  vmImage: ubuntu-latest

# non-1ES self-hosted
pool:
  name: MySelfHostedPool

# 1ES
pool:
  name: AZS-1ES-L-MMS-ubuntu-22.04
  os: linux

Test plan

Validated via existing automated suites and updated tests covering pool parsing, template emission, codemod rewrite behavior, unified marker replacement ({{ pool }}) across targets, and scalar pool codemod normalization to { name: ... }.

Copilot AI and others added 2 commits May 14, 2026 18:45
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/ae57b6df-ffaf-4666-9284-28c65c7f2ced

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
@jamesadevine
Copy link
Copy Markdown
Collaborator

@copilot Rename pool_block -> pool and apply the same config+replacement to 1ES template.

Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/a32e578f-2dbe-490f-b52c-2380cf007de9

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot Rename pool_block -> pool and apply the same config+replacement to 1ES template.

Done in f167cc5. pool_block is renamed/unified to pool, and the same pool replacement path is now applied to 1ES as well (src/data/1es-base.yml now uses {{ pool }} block output). No UI changes were involved (compiler/template change only).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • spsprodeus21.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.1rjdjwsulumkp4apt1lqqwwqf.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.1wtcbqqgr15y26jrzpzojy5yl.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.22vwyw4qau8row04yamh1u2tg.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.2orrqck80ug79b86ufp2jjx5v.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.2urfcrc7w9fv9la9nhhspzy5k.0sdluag.rcgu.o b3pd4en3xe0apsvb837.1hlegoi.rcgu.o bh9d2g8jsdd6t3ywaz0.1hlegoi.rcgu.o 3w3g0qzfm2w3rpfkusj.1hlegoi.rcgu.o 2n6b7knucw6z11zq6w1.1hlegoi.rcgu.o 3vze48f2nunq07tfk79.1hlegoi.rcgu.o ogpnm8xxvwbvuxr5937.1hlegoi.rcgu.o zyrgshkns484dcw6jxr.1hlegoi.rcgu.o pom3ilwv82o6cdem35t.1hlegoi.rcgu.o w0qdjmag8gp929b70f0.1hlegoi.rcgu.o 4463avhy1tqv0crepn7.1hlegoi.rcgu.o m4z2uky4kxkn87eo3sm.1hlegoi.rcgu.o 2i53m5i4fz965ztljrw.1hlegoi.rcgu.o 7tktets7lyjfd99g0yc.1hlegoi.rcgu.o bfestmljc56kxs51aa7.1hlegoi.rcgu.o (dns block)
  • spsprodweu4.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.1rjdjwsulumkp4apt1lqqwwqf.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.1wtcbqqgr15y26jrzpzojy5yl.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.22vwyw4qau8row04yamh1u2tg.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.2orrqck80ug79b86ufp2jjx5v.0sdluag.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-6da1eb8e557c50ba.2urfcrc7w9fv9la9nhhspzy5k.0sdluag.rcgu.o b3pd4en3xe0apsvb837.1hlegoi.rcgu.o bh9d2g8jsdd6t3ywaz0.1hlegoi.rcgu.o 3w3g0qzfm2w3rpfkusj.1hlegoi.rcgu.o 2n6b7knucw6z11zq6w1.1hlegoi.rcgu.o 3vze48f2nunq07tfk79.1hlegoi.rcgu.o ogpnm8xxvwbvuxr5937.1hlegoi.rcgu.o zyrgshkns484dcw6jxr.1hlegoi.rcgu.o pom3ilwv82o6cdem35t.1hlegoi.rcgu.o w0qdjmag8gp929b70f0.1hlegoi.rcgu.o 4463avhy1tqv0crepn7.1hlegoi.rcgu.o m4z2uky4kxkn87eo3sm.1hlegoi.rcgu.o 2i53m5i4fz965ztljrw.1hlegoi.rcgu.o 7tktets7lyjfd99g0yc.1hlegoi.rcgu.o bfestmljc56kxs51aa7.1hlegoi.rcgu.o (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title feat(compile): support vmImage pool syntax for non-1ES targets feat(compile): unify pool front-matter replacement across targets May 14, 2026
Copilot AI requested a review from jamesadevine May 14, 2026 19:12
apply: apply_codemod,
};

fn apply_codemod(fm: &mut Mapping, _ctx: &CodemodContext) -> Result<bool> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot - we need to translate the previous default

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a4e68da. The codemod now translates the legacy default pool: AZS-1ES-L-MMS-ubuntu-22.04 to pool: { vmImage: ubuntu-latest } for non-1ES sources, while preserving name-based translation for target: 1es. Screenshot: N/A (no UI change; compiler/codemod logic only).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot sorry, should have been cleaer: pool: AZS-1ES-L-MMS-ubuntu-22.04 -> pool: { name:AZS-1ES-L-MMS-ubuntu-22.04 }

@jamesadevine jamesadevine marked this pull request as ready for review May 14, 2026 20:09
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/43e0b1b8-982d-4e55-915d-95a8474898ab

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • spsprodeus21.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1gcl7iytxntv7nljmqu8h11yy.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1hvsrjg564se9k6i84zx4n18m.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1i2kcjxs7gl6ur6hcoftevybq.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1qpf12qtkcfjtw9v1g6hgjcfy.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.29rij194caixrejrzzqv6vmwq.0iylyl0.rcgu.o b3pd4en3xe0apsvb837.1wa14yz.rcgu.o eabjr8ff19kq14sdkgv.1wa14yz.rcgu.o 2n6b7knucw6z11zq6w1.1wa14yz.rcgu.o 3vze48f2nunq07tfk79.1wa14yz.rcgu.o zyrgshkns484dcw6jxr.1wa14yz.rcgu.o pom3ilwv82o6cdem35t.1wa14yz.rcgu.o w0qdjmag8gp929b70f0.1wa14yz.rcgu.o 4463avhy1tqv0crepn7.1wa14yz.rcgu.o m4z2uky4kxkn87eo3sm.1wa14yz.rcgu.o 2i53m5i4fz965ztljrw.1wa14yz.rcgu.o 7tktets7lyjfd99g0yc.1wa14yz.rcgu.o bfestmljc56kxs51aa7.1wa14yz.rcgu.o 9onadjlzqk20wgbb9k2.1wa14yz.rcgu.o 0ho6bvpk50o09d0l2eh.1wa14yz.rcgu.o (dns block)
  • spsprodweu4.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1gcl7iytxntv7nljmqu8h11yy.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1hvsrjg564se9k6i84zx4n18m.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1i2kcjxs7gl6ur6hcoftevybq.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.1qpf12qtkcfjtw9v1g6hgjcfy.0iylyl0.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-3b7233ec49ad28cb.29rij194caixrejrzzqv6vmwq.0iylyl0.rcgu.o b3pd4en3xe0apsvb837.1wa14yz.rcgu.o eabjr8ff19kq14sdkgv.1wa14yz.rcgu.o 2n6b7knucw6z11zq6w1.1wa14yz.rcgu.o 3vze48f2nunq07tfk79.1wa14yz.rcgu.o zyrgshkns484dcw6jxr.1wa14yz.rcgu.o pom3ilwv82o6cdem35t.1wa14yz.rcgu.o w0qdjmag8gp929b70f0.1wa14yz.rcgu.o 4463avhy1tqv0crepn7.1wa14yz.rcgu.o m4z2uky4kxkn87eo3sm.1wa14yz.rcgu.o 2i53m5i4fz965ztljrw.1wa14yz.rcgu.o 7tktets7lyjfd99g0yc.1wa14yz.rcgu.o bfestmljc56kxs51aa7.1wa14yz.rcgu.o 9onadjlzqk20wgbb9k2.1wa14yz.rcgu.o 0ho6bvpk50o09d0l2eh.1wa14yz.rcgu.o (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/ba1c7870-b00a-4daa-9761-7f9f369222a6

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • spsprodeus21.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d--as-needed /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d-dynamic-linker /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d/lib64/ld-linux-x86-64.so.2 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d-pie /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d-z j2d1kp19qdbg8d9sogxp5ov.0l98rm6.rcgu.o hudh1sdngd18afke8mom3ck.0l98rm6.rcgu.o 6y9q1jf8l2g7p6pww1tlnqg.0l98rm6.rcgu.o 89zs3z0hkc0gsi5gqy9r6mx.0l98rm6.rcgu.o vrngwyi3rf038ls57medot4.0l98rm6.rcgu.o 6ld1tfvgm76tr568gs3h806.0l98rm6.rcgu.o jdjwsulumkp4apt1lqqwwqf.0l98rm6.rcgu.o tcbqqgr15y26jrzpzojy5yl.0l98rm6.rcgu.o vwyw4qau8row04yamh1u2tg.0l98rm6.rcgu.o rrqck80ug79b86ufp2jjx5v.0l98rm6.rcgu.o rfcrc7w9fv9la9nhhspzy5k.0l98rm6.rcgu.o 6b38rubtgyrpminynr4nm5j.0l98rm6.rcgu.o 96toy3jivs4056p69t1bs59.0l98rm6.rcgu.o kwso4ec2dpaa8xpfjcqn0s4.0l98rm6.rcgu.o (dns block)
  • spsprodweu4.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-3136f96127ec4700 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d--as-needed /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d-dynamic-linker /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d/lib64/ld-linux-x86-64.so.2 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d-pie /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/codemod_tests-63d282cbd9099a7d-z j2d1kp19qdbg8d9sogxp5ov.0l98rm6.rcgu.o hudh1sdngd18afke8mom3ck.0l98rm6.rcgu.o 6y9q1jf8l2g7p6pww1tlnqg.0l98rm6.rcgu.o 89zs3z0hkc0gsi5gqy9r6mx.0l98rm6.rcgu.o vrngwyi3rf038ls57medot4.0l98rm6.rcgu.o 6ld1tfvgm76tr568gs3h806.0l98rm6.rcgu.o jdjwsulumkp4apt1lqqwwqf.0l98rm6.rcgu.o tcbqqgr15y26jrzpzojy5yl.0l98rm6.rcgu.o vwyw4qau8row04yamh1u2tg.0l98rm6.rcgu.o rrqck80ug79b86ufp2jjx5v.0l98rm6.rcgu.o rfcrc7w9fv9la9nhhspzy5k.0l98rm6.rcgu.o 6b38rubtgyrpminynr4nm5j.0l98rm6.rcgu.o 96toy3jivs4056p69t1bs59.0l98rm6.rcgu.o kwso4ec2dpaa8xpfjcqn0s4.0l98rm6.rcgu.o (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…ct_form codemod

When pool is absent from front matter and the binary version is at or
above 0.30.0 (the release that changed the implicit default from the
1ES self-hosted pool to vmImage: ubuntu-latest), the codemod now injects
pool: { name: AZS-1ES-L-MMS-ubuntu-22.04 } to prevent silent breakage
of existing pipelines.

- Add compiler_version field to CodemodContext
- Gate absent-pool injection on version >= introduced_in
- Add version_gte helper for semver comparison
- Add tests for version-gated and version-ungated behaviour

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine merged commit 7806369 into main May 14, 2026
5 checks passed
@jamesadevine jamesadevine deleted the copilot/update-pool-frontmatter branch May 14, 2026 20:50
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Rust PR Review

Summary: needs changes — one real YAML-corruption bug and one codemod logic issue

Findings

🐛 Bugs / Logic Issues

  • src/compile/common.rs:1818–1826 and 1852–1863generate_setup_job and generate_teardown_job embed the pool string via Rust's format! macro, not replace_with_indent. For 1ES targets the pool resolves to a multi-line string ("name: AZS-1ES-L-MMS-ubuntu-22.04\nos: linux"). format! inserts the raw string verbatim, so the second line ends up with zero indentation, producing invalid YAML:
    pool:
      name: AZS-1ES-L-MMS-ubuntu-22.04

os: linux # ← wrong indent, invalid YAML
steps:

This only fires for 1ES pipelines that define `setup:` or `teardown:` steps, but it silently emits broken YAML when it does. The fix is to build a well-indented string before passing to `format!`, or to use `replace_with_indent` on the generated snippet.

- **`src/compile/codemods/0002_pool_object_form.rs:54–67`** — The "absent pool injection" is version-gated on the *current binary*, not on when the source file was authored. A brand-new non-1ES pipeline that intentionally omits `pool:` (relying on the new `vmImage: ubuntu-latest` default) will have `pool: { name: AZS-1ES-L-MMS-ubuntu-22.04 }` force-injected whenever it is compiled with `≥ 0.30.0`. The codemod cannot distinguish "file written under old default, preserve it" from "file written under new default, leave it alone". Concretely, every new standalone pipeline without an explicit pool now silently compiles against the 1ES self-hosted pool instead of the intended `ubuntu-latest`. Consider gating the injection on the `target:` field (only inject for `target: 1es`) or removing the absent-pool injection branch entirely and relying on the compile-time default.

#### ⚠️ Suggestions

- **`src/compile/common.rs:1062–1066`** — The `(None, None)` branch in the non-1ES `PoolConfig::Full` arm silently falls back to `vmImage: ubuntu-latest`. This is reached when a user writes `pool: {}` (empty object). A small comment or an explicit variant check would make the intent clearer, and a test for this edge case would prevent regression.

#### ✅ What Looks Good

- `replace_with_indent` correctly propagates indentation to all subsequent lines, so the direct `\{\{ pool }}` substitution in all four base templates works correctly for both single-line and two-line pool blocks.
- The 1ES rejection of `pool.vmImage` with a descriptive `bail!` message is the right guard.
- `CodemodContext::current()` replacing the `CodemodContext {}` struct literal is a clean, forward-compatible change.
- The test coverage for `resolve_pool_block` (non-1ES default, name, vmImage, 1ES default, 1ES with custom OS) is thorough.

> Generated by [Rust PR Reviewer](https://github.com/githubnext/ado-aw/actions/runs/25884840962/agentic_workflow) for issue #538 · ● 721.3K · [◷](https://github.com/search?q=repo%3Agithubnext%2Fado-aw+%22gh-aw-workflow-call-id%3A+githubnext%2Fado-aw%2Frust-pr-reviewer%22&type=issues)

<!-- gh-aw-agentic-workflow: Rust PR Reviewer, engine: copilot, model: auto, id: 25884840962, workflow_id: rust-pr-reviewer, run: https://github.com/githubnext/ado-aw/actions/runs/25884840962 -->
<!-- gh-aw-workflow-call-id: githubnext/ado-aw/rust-pr-reviewer -->

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.

2 participants