PUBLIC BETA OFFER

Save 50% off on an Eligible Learning PlanValid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026

AZ-401: YAML Triggers Job Dependencies and Parallel Execution

Author separate Azure Pipelines and GitHub Actions execution graphs with deliberate event filters, dependencies, bounded matrices and permission checks, then verify expected skips and failures.

Guide

Content version 1.0

AZ-401: YAML Triggers Job Dependencies and Parallel Execution

AZ-401: YAML Triggers Job Dependencies and Parallel Execution

Author reviewable YAML (YAML Ain’t Markup Language) by defining the event that admits a run, the prerequisites for each job, and the available execution capacity separately. Write an Azure Pipelines graph using its stages, jobs and dependsOn; write a GitHub Actions graph using workflow events, jobs and needs. Bound matrix expansion, keep token permissions explicit, and compare expected triggers, skips and failures with the actual run evidence before accepting the configuration.

The two complete examples below are small graph exercises for Azure DevOps Services connected to GitHub.com and for GitHub Actions. Their steps print fixed markers; they do not build an application, prove test quality or deploy anything. No workflow or pipeline was executed for this article. Use AZ-401: Choosing Delivery Automation and Connecting GitHub Repositories first to establish the authorized source connection and distinguish the two execution systems.

Establish the event and execution contract

Choose an existing nonproduction repository and the platform owner who can review its automation. Preserve the existing pipeline or workflow definition and record the proposed file location, source revision, enabled events, permitted runner or agent selection, capacity and restoration plan. Review the actual organization and repository restrictions before introducing even a small exercise; a valid document does not establish permission to run it.

Use this example contract, replacing the names only after reviewing the actual repository:

  • A continuous integration (CI) run is relevant to pushes on main that affect selected source or the platform's own configuration file.
  • A pull request (PR) run is relevant when its target is main and its changed paths match the same selection.
  • An identification job precedes two fixed configuration legs; a completion marker follows successful required work.
  • At most two legs of that matrix may execute together, subject to actual capacity.
  • The exercise needs no secret, repository write operation or production resource.

Record these expectations before asking GitHub Copilot to propose changes. Give it the selected platform, existing configuration and permitted scope. Review generated syntax against that platform's reference and inspect the actual diff. Copilot output can contain errors; its proposed success message is not evidence that a job ran.

Author the Azure Pipelines graph

For the established Azure Pipelines GitHub connection, the following example uses azure-pipelines.yml at the repository root. Both push and PR filters include the configuration itself so its changes can be evaluated. Branch and path selection are separate: PR branch selection concerns the target branch, while CI branch selection concerns the pushed branch. Git paths are case sensitive.

trigger:
  branches:
    include: [main]
  paths:
    include: ['src/**', 'azure-pipelines.yml']

pr:
  branches:
    include: [main]
  paths:
    include: ['src/**', 'azure-pipelines.yml']

pool:
  vmImage: ubuntu-latest

stages:
- stage: Validate
  jobs:
  - job: Identify
    steps:
    - script: echo "Inspect the selected graph"

  - job: Check
    dependsOn: Identify
    strategy:
      matrix:
        Alpha:
          configurationName: alpha
        Beta:
          configurationName: beta
      maxParallel: 2
    steps:
    - script: echo "Configuration $(configurationName)"

- stage: Summarize
  jobs:
  - job: Complete
    steps:
    - script: echo "Required stage completed"

Identify supplies a root job with no job dependency. Check waits for it, then the matrix supplies two variable sets. Summarize follows Validate in the default stage sequence. Steps within each job are sequential. This is an Azure DevOps Services YAML example; Classic release sequencing is a separate model.

Azure YAML jobs in one stage can run in parallel unless dependencies order them. A job normally runs when it has no job dependencies or its dependencies completed successfully; any containing-stage conditions still matter. An author-supplied condition changes that decision and must be reviewed with the dependencies. A syntactically valid cycle or a graph with no dependency-free starting job cannot express the intended execution.

maxParallel bounds this matrix's concurrent legs. It does not supply agents or parallel-job entitlement. Azure's matrix and parallel strategies are mutually exclusive, and maxParallel belongs with matrix. Each agent runs one job at a time; inspect available matching agents and parallel-job capacity when an eligible leg stays queued.

The example's second stage is a logical grouping, with no deployment or environment binding. Stage order and author conditions do not create an independent resource-owner approval. Keep that separate decision in AZ-401: Protected Deployment Environments and Approvals.

Author the GitHub Actions graph independently

For the GitHub example, the proposed file is .github/workflows/graph.yml. Keep the file in the repository's workflow directory and review its effective event configuration. The branches and paths under one event must both match; a push and a PR are distinct events, so evaluate each independently.

name: Bounded execution graph

on:
  push:
    branches: [main]
    paths: ['src/**', '.github/workflows/graph.yml']
  pull_request:
    branches: [main]
    paths: ['src/**', '.github/workflows/graph.yml']

permissions: {}

jobs:
  identify:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Inspect the selected graph"

  check:
    needs: identify
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      max-parallel: 2
      matrix:
        configuration: [alpha, beta]
    steps:
      - name: Show the fixed configuration
        env:
          GRAPH_CONFIGURATION: ${{ matrix.configuration }}
        run: printf '%s\n' "$GRAPH_CONFIGURATION"

  complete:
    needs: check
    runs-on: ubuntu-latest
    steps:
      - run: echo "Required jobs completed"

needs orders jobs; it is not Azure's dependsOn. Here identify starts without a dependency, the two check legs follow, and complete needs successful completion of check. A failed or skipped prerequisite normally causes dependent jobs to be skipped. A deliberate job condition can alter that behavior; review the resulting failure path rather than accepting a graph solely because its last visible marker is green.

This matrix uses max-parallel, with a hyphen. fail-fast: false allows the other leg to continue when one fails; it does not make the failing leg successful or satisfy complete's prerequisite. Actual runner availability still limits concurrency. The two fixed values are supplied through an environment variable to the shell, without inserting event-provided text into a command.

The workflow's repository token, GITHUB_TOKEN, has its declared permissions disabled with permissions: {}. These marker steps need no repository checkout or token operation. For real work, identify the operation first and review any required workflow- or job-level permission under the actual repository, organization and event restrictions. A job-level permissions declaration applies to that job; unspecified permission entries become none when entries are specified. Never add broad write access merely to fix a queue or syntax failure.

Separate graph dependencies from execution state

A dependency orders eligible work; it does not transfer a previous job's directory, process or installed software. The examples intentionally exchange no files. For an application pipeline, design and verify explicit data transfer separately before making a downstream job consume an output.

Microsoft-hosted Azure agents provide a fresh execution environment per job. Self-hosted agents can retain state, but a later job is not guaranteed to select the same agent. Neither case makes a dependency a shared filesystem contract. Confirm the chosen image, tools, access and capacity without assuming a successful earlier job prepared the next machine.

For GitHub self-hosted routing, the runner must match the selected labels and groups and be available; a label alone does not establish capacity or isolation. Runner hardware and connectivity must fit the work. Container actions and service containers on a self-hosted runner additionally require Linux and Docker. The sample selects hosted Ubuntu execution and introduces no container requirement.

Keep untrusted changes and privileged work apart. GitHub's secure-use guidance warns that secret redaction is not guaranteed and that untrusted code can compromise execution environments. Do not attach sensitive credentials to these graph checks or assume that a restricted workflow token makes a reused self-hosted machine clean.

Verify the admitted events and failure paths

After owner review, use a bounded branch and harmless test changes in the authorized repository. The following are expected observations to verify, not results obtained here. Record the actual event, base or source branch as applicable, changed paths, configuration revision, graph, job states and runner or agent evidence.

Controlled case Expected graph behavior Evidence that resolves the outcome
Push a selected source change on main The configured CI event admits a run Actual event, branch, changed paths and selected definition
Open an authorized PR targeting main with a selected source change The configured PR event can admit a run, subject to actual platform and repository controls PR identity, target, configuration and any required approval or trigger limitation
Push only an unselected path such as notes/example.txt This path selection does not admit a run Changed-path evidence; distinguish event exclusion from a skipped job inside a run
Run the unchanged marker graph Identification precedes matrix legs; completion follows successful required work Actual graph and step logs, not the existence of a queued record
In a separate approved test change, replace a matrix marker step with exit 1 That leg fails; ordinary dependent completion does not count as successful Actual failure, remaining leg behavior and downstream skip or condition evidence
Eligible work waits without starting Investigate capacity and routing separately from graph order Online matching execution resources, queue evidence and applicable limits

An excluded push does not establish that another event, such as a PR update, was excluded. A manually queued Azure run also does not establish CI or PR triggering. For the Azure Pipelines App connection, preserve the documented first-organization automatic-trigger condition when multiple Azure DevOps organizations consume one repository. Azure Pipelines Checks and GitHub Actions runs remain distinct evidence sources.

Compare the selected graph with the expected dependency edges and number of matrix legs. Inspect failure and skip reasons separately. If a job is unexpectedly allowed to continue, examine its condition and error-handling settings; if it cannot start, examine its event, prerequisites, permissions and execution resources without widening access by default.

Restore the original demonstration step and any temporary event filters through the normal review path. Close only the owned test change and preserve the before/after configuration and actual observations. Leave shared connections, runner registrations and unrelated workflows intact. Reusable templates belong to AZ-401: Reusable YAML Templates Variables and Classic Task Groups; independent environment approvals remain a separate control.

Authoritative Sources

0 views