Bitzu

AZ-400 ยท Pipeline foundations

Authoring YAML pipelines

Azure Pipelines YAML hierarchy (stages, jobs, steps, tasks, script), pool, conditions, expressions and runtime vs compile-time syntax; GitHub Actions workflow structure (jobs, steps, uses, run, needs, if, outputs).

Key points

  • Azure Pipelines: stages > jobs > steps; a step is a task or script/bash/pwsh; pool picks the agent; condition gates.
  • ${{ }} expands before the run, so it cannot see run-time values; $(var) and $[ ] resolve later.
  • Each step is its own process; pass values with ##vso[task.setvariable].
  • GitHub Actions: jobs have runs-on and steps; a step has uses or run; needs orders jobs, if gates them, outputs share values.

Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/runs?view=azure-devops

Practice questions

Single choice

In an Azure Pipelines multi-stage YAML file, what is the correct nesting from outermost to innermost?

  1. stage, job, step
  2. job, stage, step
  3. step, job, stage
  4. pool, step, job
Show answer

Answer: A. stage, job, step

Stages contain jobs and jobs contain steps (tasks or scripts).

Select all that apply

Which keys belong to GitHub Actions workflow syntax?

  1. uses
  2. run
  3. needs
  4. pool
  5. dependsOn
Show answer

Answer: A. uses, B. run, C. needs

uses runs a packaged action, run executes a shell command and needs orders jobs. pool and dependsOn are Azure Pipelines keywords.

True or false

In Azure Pipelines, an environment variable set by one script step is still available to the next step in the same job.

Show answer

Answer: False

False. Each step runs in its own process. Use the setvariable logging command to turn a value into a pipeline variable for later steps.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More AZ-400 topics in this module