DevOps Workflows
Adds Azure DevOps Pipelines support to Atom — pipeline YAML generation, DevOps-specific options, and access to Azure DevOps environment variables. Add it when you want Atom to generate Azure Pipelines YAML.
Package: Invex.Atom.Module.DevOpsWorkflows
Installation
dotnet add package Invex.Atom.Module.DevOpsWorkflows
Usage
[BuildDefinition]
[GenerateEntryPoint]
internal partial class Build : WorkflowBuildDefinition, IDevOpsWorkflows
{
public override IReadOnlyList<WorkflowDefinition> Workflows =>
[
new("Build")
{
Triggers = [WorkflowTriggers.PushToMain],
Targets = [new(nameof(Compile))],
Types = [WorkflowTypes.DevOps.Pipeline],
},
];
}
Features
Pipeline Generation
Generates Azure DevOps Pipeline YAML files.
DevOps Static Class
Access Azure DevOps environment variables:
if (DevOps.IsDevOpsPipelines)
{
var buildId = DevOps.Variables.BuildBuildId;
var branch = DevOps.Variables.BuildSourceBranch;
}
Variable Provider
DevOpsVariableProvider maps Atom variables to Azure DevOps pipeline variables.
Report Writer
DevOpsSummaryOutcomeReportWriter writes build report data to the Azure DevOps build summary.
Pool Labels
WorkflowLabels.DevOps.Pool.Ubuntu_Latest
WorkflowLabels.DevOps.Pool.Windows_Latest
WorkflowLabels.DevOps.Pool.MacOS_Latest
DevOps-Specific Options
BuildOptions.DevOps.DevOpsPool.SetByMatrix— set the agent pool from a matrix dimensionBuildOptions.DevOps.VariableGroup.*— reference Azure DevOps variable groupsBuildOptions.DevOps.Concurrency.RunLatest— run only the latest pipeline waiting on an exclusive lockBuildOptions.DevOps.Concurrency.Sequential— run every pipeline waiting on an exclusive lock in sequenceBuildOptions.DevOps.PullRequest.AutoCancel— cancel an in-progress PR run when a new commit is pushedBuildOptions.DevOps.PullRequest.KeepRunning— allow in-progress PR runs to finish after new commitsProvideDevOpsRunIdAsWorkflowId— use the DevOps run ID as the Atom build ID
Configure the lock behavior on a WorkflowDefinition:
Options =
[
BuildOptions.DevOps.Concurrency.Sequential,
];
Azure Pipelines applies lockBehavior to resources protected by an
exclusive lock check.
Configure pull request auto-cancellation alongside a pull request trigger:
new("Validate")
{
Triggers = [WorkflowTriggers.PullInto("main", "develop")],
Options = [BuildOptions.DevOps.PullRequest.AutoCancel],
}
See also
- Workflow Definitions: declaring workflows.
- GitHub Workflows: the GitHub Actions counterpart.
- IDevOpsWorkflows
- DevOps
- DevOpsConcurrencyOption
- DevOpsPullRequestOption