IAzurePipelinesCommands should support the Command formatting command #4914
Closed
perclausen
started this conversation in
Extension requests
Replies: 2 comments 3 replies
|
You can interact with Azure Pipelines logs, groups, and variables using the These capabilities are fully exposed via the IAzurePipelinesCommands API. Here is an example of how to use it in your Cake script: Task("AzurePipelines-Demo")
.Does(() => {
// Check if the current build is running on Azure Pipelines
if (AzurePipelines.IsRunningOnAzurePipelines) {
// Write warnings and errors directly to the pipeline UI
AzurePipelines.Commands.WriteWarning("This is a custom pipeline warning.");
AzurePipelines.Commands.WriteError("This is a custom pipeline error.");
// Format log outputs into a collapsible section
AzurePipelines.Commands.BeginGroup("My Custom Log Group");
Information("This line is hidden inside the collapsible group.");
AzurePipelines.Commands.EndGroup();
using(AzurePipelines.Commands.Group("Group"))
{
// try / finally auto collapsible section
}
AzurePipelines.Commands.Section("Section name");
// Set an output variable for subsequent DevOps pipeline steps
AzurePipelines.Commands.SetVariable("MyOutputVar", "CustomValue");
}
}); |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Currently,
IAzurePipelinesCommandssupports all but the##[command]formatting command.Would be nice with a
Comandmethod like e.g.Section.https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#formatting-commands
Workaround:
Console.WriteLine($"##[command]{command}");All reactions