Designing pipelines: tools, agents, triggers and YAML

AZ-400 DevOps EngineerBuild and release pipelinesAbout 30 minutesBy Cloud Hands On

GitHub Actions or Azure Pipelines, runner and agent infrastructure, GitHub repositories in Azure Pipelines, triggers, YAML structure and job order.

In this lesson you'll learn

1. Choosing the automation tool

Both run YAML pipelines, both deploy to Azure, both support OpenID Connect. Pick by where the code and people are:

  • GitHub Actions: code in GitHub, a huge marketplace of actions, workflows in .github/workflows.
  • Azure Pipelines: strong for complex multi-stage releases, environments with checks, classic release history, Azure Repos or GitHub sources, and organisations standardised on Azure DevOps.

Mixing is common: code and pull request checks in GitHub, releases in Azure Pipelines, using the Azure Pipelines GitHub App to connect a GitHub repository (it reports status checks back to the pull request).

2. Runners and agents

OptionStrengthsWatch out for
Microsoft-hosted agent / GitHub-hosted runnerNo maintenance, clean VM each job, common tools installedCan't reach private networks; limited minutes and parallel jobs; no state between jobs
Self-hosted agent or runnerYour tools, private network access, caches persist, no per-minute chargeYou patch, secure and scale it; risky with untrusted pull requests
Managed DevOps Pools / scale set agentsAzure scales agents for you, inside your virtual networkYou pay for the VMs
GitHub larger runnersMore CPU and RAM, static IPs, private networking optionsPer-minute cost

Azure Pipelines charges by parallel jobs: one Microsoft-hosted job is free (with a monthly minute limit) for private projects; more need buying. Self-hosted parallel jobs have their own allowance. GitHub Actions includes monthly minutes by plan; Linux minutes cost least.

3. Triggers

  • CI trigger: trigger: with branch and path filters, so docs changes don't build.
  • Pull request trigger: pr: (for GitHub; Azure Repos uses build validation branch policies).
  • Scheduled: schedules: with cron, optionally always: true to run with no changes.
  • Pipeline completion: resources: pipelines: with a trigger, so a release pipeline runs when a build pipeline finishes.
  • GitHub Actions: on: push, pull_request, schedule, workflow_dispatch (manual), workflow_run.

4. YAML structure and job order

A pipeline has stages, a stage has jobs, a job has steps (tasks or scripts). Jobs run on agents; steps in a job share the agent.

  • Order: stages run in sequence by default; dependsOn changes that. dependsOn: [] makes a stage run in parallel.
  • Conditions: condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')).
  • Parallelism: a strategy: matrix runs one job for each combination (OS, version); parallel: N splits work such as tests.
  • Passing data: output variables between jobs, and pipeline artifacts between stages.

Complex scenarios include hybrid pipelines (cloud and on-premises targets via self-hosted agents), VM templates (images built with Packer or Azure VM Image Builder) and container jobs.

Example

Larkfield Group's build stage uses Microsoft-hosted agents with a matrix for Windows and Linux. The deploy stage targets an internal API, so it runs on a Managed DevOps Pool inside the company's virtual network. A path filter skips builds for changes to /docs.

Exam traps to remember

  • Hosted agents can't reach private networks: use self-hosted agents or Managed DevOps Pools.
  • dependsOn: [] removes the default dependency so a stage runs in parallel.
  • Path filters stop unrelated changes from triggering builds.

Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-400 DevOps Engineer app.

Practise in the app

Keep going