Back to Dagger

Azure Pipelines

docs/versioned_docs/version-1.0-beta/adopting/triggers/azure-pipelines.mdx

0.21.52.8 KB
Original Source

Azure Pipelines

Azure Pipelines can run dagger check in any pipeline, so the same checks you run locally run on every push — without rewriting your pipeline.

:::tip For checks with no pipeline YAML at all, enable Cloud Checks with dagger ws autocheck on. The Azure Pipeline below is the hybrid-mode alternative for when you want to drive Dagger from your existing Azure Pipelines setup. :::

How it works

When running a CI pipeline with Dagger using Azure Pipelines, the general workflow looks like this:

  1. Azure Pipelines receives a trigger based on a repository event.
  2. Azure Pipelines begins processing the steps in the azure-pipelines.yml file.
  3. Azure Pipelines downloads the Dagger CLI.
  4. Azure Pipelines runs dagger check against the modules installed in your workspace.
  5. The Dagger CLI attempts to find an existing Dagger Engine or spins up a new one inside the Azure Pipelines runner.
  6. The Dagger CLI sends telemetry to Dagger Cloud if the DAGGER_CLOUD_TOKEN environment variable is set.
  7. The pipeline completes with success or failure, based on the check results. Logs appear in Azure Pipelines as usual.

Prerequisites

  • An Azure DevOps organization and project
  • An Azure Pipelines agent to run jobs connected to the project
  • A repository with a Dagger workspace (.dagger/config.toml) — see Workspace Setup.

Example

The following example runs all of your workspace's checks with dagger check:

yaml

dagger check runs every check and exits non-zero if any fails. You can scope it to a subset — for example dagger check go:* to run a single module's checks.

Dagger Cloud Engines

By default the Dagger CLI starts a Dagger Engine inside the Azure Pipelines runner. For a faster, more reliable experience, offload execution to a managed Dagger Engine provided by Dagger Cloud by adding --cloud to the command:

shell
dagger check --cloud

Cloud Engines provide a large persistent cache shared across runs and far more compute than an Azure Pipelines runner, so checks are typically much faster — and you don't provision or maintain any infrastructure. This requires the DAGGER_CLOUD_TOKEN secret configured for the pipeline.

Resources

If you have any questions about additional ways to use Azure Pipelines with Dagger, join our Discord and ask your questions in our help channel.

About Azure Pipelines

Azure Pipelines is the CI/CD service of Azure DevOps. It enables developers to quickly and easily build, test and deploy their applications, and works with multiple languages and platforms. It supports both self-hosted and managed agents.