Skip to content

feat(ir): add typed helpers for Docker@2#1086

Merged
jamesadevine merged 1 commit into
mainfrom
feat/ir-docker-v2-typed-helpers-750f94aa690398a6
Jun 18, 2026
Merged

feat(ir): add typed helpers for Docker@2#1086
jamesadevine merged 1 commit into
mainfrom
feat/ir-docker-v2-typed-helpers-750f94aa690398a6

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds five typed factory functions for Docker@2 to the ado-aw IR (src/compile/ir/tasks.rs).

Motivation

Previously, any code that needed to emit a Docker@2 pipeline step had to hand-craft
TaskStep::new("Docker@2", ...) with raw string inputs. This PR introduces well-typed
helpers that make the command/mode boundary explicit and self-documenting, consistent with
the existing typed helpers for DockerInstaller@0, CopyFiles@2, PowerShell@2, etc.

Changes

  • src/compile/ir/tasks.rs: five new factory functions + twelve unit tests
Function Docker@2 command Description
docker_build_and_push_step() buildAndPush Build image and push in one step (most common)
docker_build_step() build Build image only
docker_push_step() push Push a previously-built image
docker_login_step() login Authenticate to a container registry
docker_logout_step() logout Log out from a container registry

All inputs except command (baked into the factory) are applied via .with_input(...):

// Build and push with custom registry, repo, and tags
let step = docker_build_and_push_step()
    .with_input("containerRegistry", "myRegistryServiceConnection")
    .with_input("repository", "myapp")
    .with_input("tags", "latest\n$(Build.BuildId)");

// Separate build → scan → push pattern
let build = docker_build_step()
    .with_input("Dockerfile", "src/Dockerfile")
    .with_input("repository", "myapp");
let push = docker_push_step()
    .with_input("containerRegistry", "myRegistry")
    .with_input("repository", "myapp");

ADO Task Reference

Validation

  • cargo build --all-targets
  • cargo test — 2045+ tests pass (12 new Docker@2 tests)
  • 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 · 1.1K AIC · ⌖ 20.6 AIC · ⊞ 36.6K ·

Add five factory functions for the Docker@2 ADO built-in task to
src/compile/ir/tasks.rs:

- docker_build_and_push_step()  — buildAndPush (most common case)
- docker_build_step()           — build only
- docker_push_step()            — push only
- docker_login_step()           — login to a container registry
- docker_logout_step()          — logout from a container registry

Each function follows the established pattern: the ADO command is
baked into the factory, required/commonly-needed inputs are positional
parameters where applicable, and optional inputs are applied via
.with_input(…) on the returned TaskStep.

Twelve unit tests are included covering default state, optional input
chaining, and the login/logout symmetry invariant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine marked this pull request as ready for review June 18, 2026 06:20
@jamesadevine jamesadevine merged commit 9f738c4 into main Jun 18, 2026
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