feat(ir): add typed builder for AzurePowerShell@5#1127
Merged
Conversation
Adds AzurePowerShell struct with file() and inline() entry points returning distinct typestate builders (AzurePowerShellFile / AzurePowerShellInline). ScriptArguments is only available on the file builder; the inline script body is only accepted by the inline builder, so mixing inputs with the wrong mode is unrepresentable. Shared optionals (errorActionPreference, FailOnStandardError, pwsh, workingDirectory, azurePowerShellVersion) are available on both builders via the shared_setters! macro. The AzurePowerShellVersion enum models the LatestVersion / OtherVersion + preferredAzurePowerShellVersion pair so callers express intent in one call. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a typed builder struct for
AzurePowerShell@5to the ado-aw IR.Motivation
Previously, any code that needed to emit an
AzurePowerShell@5step had to hand-craftTaskStep::new(...)with raw string input keys. This PR introduces a command-dispatch typed builder withfile()andinline()entry points returning distinct typestate builders (AzurePowerShellFile/AzurePowerShellInline) so:ScriptArgumentsis only available on the file builder — applying it to an inline target is a compile error rather than a silent drop.Inline) is only accepted by the inline builder.AzurePowerShellVersionenum models theLatestVersion/OtherVersion+preferredAzurePowerShellVersionpair so callers express version intent in a single call.bool_input.Changes
src/compile/ir/tasks/azure_powershell.rs: newAzurePowerShellentry-point struct +AzurePowerShellFile/AzurePowerShellInlinetypestate builders +ErrorActionPreferenceandAzurePowerShellVersionenums +#[cfg(test)] mod tests(5 tests)src/compile/ir/tasks/mod.rs:pub mod azure_powershell;declaration (alphabetical order)ADO Task Reference
AzurePowerShell@5azureSubscription,ScriptType(implicit from builder variant)ScriptPath,ScriptArgumentsInlineerrorActionPreference,FailOnStandardError,pwsh,workingDirectory,azurePowerShellVersion/preferredAzurePowerShellVersionValidation
cargo build --all-targetscargo testcargo clippy --all-targets --all-features --workspace -- -D warningsCreated 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.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.