Skip to content

feat(ir): add typed builder for AzureResourceManagerTemplateDeployment@3 - #1232

Merged
jamesadevine merged 3 commits into
mainfrom
feat/ir-arm-template-deployment-v3-2422891903cf792b
Jul 1, 2026
Merged

feat(ir): add typed builder for AzureResourceManagerTemplateDeployment@3#1232
jamesadevine merged 3 commits into
mainfrom
feat/ir-arm-template-deployment-v3-2422891903cf792b

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds a typed builder struct for AzureResourceManagerTemplateDeployment@3 to the ado-aw IR.

Motivation

Previously, any code that needed to emit this ADO task step had to hand-craft TaskStep::new(...) with raw string input keys and no compile-time enforcement of which inputs are required for which deployment scope. This PR introduces a command-dispatch typed builder so required inputs are positional, scope/input combinations are type-checked, and call sites stop using stringly-typed keys.

Changes

  • src/compile/ir/tasks/arm_template_deployment.rs: new ArmTemplateDeployment builder struct with the following types:
    • ArmDeploymentCommand — five-variant enum (ResourceGroupDeploy, ResourceGroupDelete, SubscriptionDeploy, ManagementGroupDeploy, TenantDeploy); each variant carries its own scope-specific struct so invalid scope/input combos are unrepresentable
    • ArmDeploymentMode — typed enum for Incremental / Complete / Validation
    • ArmTemplateSource — typed enum for Linked artifact vs URL of the file with a shared with_parameters_file setter
    • Per-scope structs with typed optional setters for shared deploy options (deployment_mode, override_parameters, deployment_name, deployment_outputs, add_spn_to_environment, use_without_json)
    • 7 unit tests covering all deployment scopes, both template sources, and optional inputs
  • src/compile/ir/tasks/mod.rs: pub mod arm_template_deployment; declaration (alphabetical order)

ADO Task Reference

  • Task: AzureResourceManagerTemplateDeployment@3
  • Docs: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-resource-manager-template-deployment-v3
  • Required inputs (vary by scope): deploymentScope, azureResourceManagerConnection, subscriptionId (not for MG/Tenant), resourceGroupName (RG only), location, templateLocation, csmFile/csmFileLink
  • Optional inputs: deploymentMode, overrideParameters, deploymentName, deploymentOutputs, addSpnToEnvironment, useWithoutJSON

Validation

  • cargo build --all-targets
  • cargo test (7 new tests, all passing)
  • cargo clippy --all-targets --all-features --workspace -- -D warnings

Created by the ado-task-ir-contributor workflow.

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com
  • spsprodweu4.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"
    - "spsprodweu4.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by ADO Task IR Contributor · 830.2 AIC · ⌖ 66.2 AIC · ⊞ 38.8K ·

Add a command-dispatch typed builder struct for
`AzureResourceManagerTemplateDeployment@3`, covering all four deployment
scopes (Resource Group, Subscription, Management Group, Tenant) and the
Resource Group delete action.

- `ArmTemplateDeployment`: main builder wrapping `ArmDeploymentCommand`
- `ArmDeploymentCommand`: enum with five variants, each carrying a
  scope-specific struct so invalid scope/input combos are unrepresentable
- `ArmDeploymentMode`: typed enum for `Incremental` / `Complete` /
  `Validation` deployment modes
- `ArmTemplateSource`: typed enum for `Linked artifact` vs `URL of the file`
  with a shared `with_parameters_file` setter
- Per-scope structs (`ResourceGroupDeploy`, `ResourceGroupDelete`,
  `SubscriptionDeploy`, `ManagementGroupDeploy`, `TenantDeploy`) with
  typed optional setters for shared deploy options
- 7 unit tests covering all variants, both template sources, and optional
  inputs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot mentioned this pull request Jun 27, 2026
jamesadevine and others added 2 commits July 1, 2026 15:02
…p validation

Integrates the AzureResourceManagerTemplateDeployment@3 typed builder with the front-matter task-step advisory validation added in #1096. The task dispatches on deploymentScope and (for Resource Group) on action, so it supplies a bespoke validate_inputs: scope/action-specific required inputs are checked and removed, then the remainder is validated against a deny_unknown_fields template-deploy schema (empty for DeleteRG), reporting inputs used for the wrong scope/action. ArmDeploymentMode derives Deserialize; defaults (scope=Resource Group, action=Create Or Update Resource Group) and input set match the AzureResourceManagerTemplateDeploymentV3 task.json. Registered in parse.rs VALIDATORS.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine
jamesadevine marked this pull request as ready for review July 1, 2026 14:09
@jamesadevine
jamesadevine merged commit b41491a into main Jul 1, 2026
@jamesadevine
jamesadevine deleted the feat/ir-arm-template-deployment-v3-2422891903cf792b branch July 1, 2026 14:09
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