Hint: Build pipelines automate code prep, not manual tasks [OK]
Common Mistakes:
Confusing build pipeline with code repository
Thinking build pipelines monitor user activity
Assuming build pipelines are for manual testing
2. Which YAML snippet correctly defines a trigger for a build pipeline on the 'main' branch?
easy
A. trigger:\n branches:\n - main
B. trigger:\n branches:\n exclude:\n - main
C. trigger:\n paths:\n include:\n - main
D. trigger:\n branches:\n include:\n - main
Solution
Step 1: Understand trigger syntax in YAML
The trigger block uses 'branches' with 'include' to specify branches that start the pipeline.
Step 2: Check each option
trigger:\n branches:\n include:\n - main correctly includes 'main' branch under 'branches' and 'include'. trigger:\n branches:\n exclude:\n - main excludes 'main', which disables trigger on it. trigger:\n paths:\n include:\n - main uses 'paths' which triggers on file changes, not branches. trigger:\n branches:\n - main misses 'include' keyword, so syntax is incorrect.
Final Answer:
trigger:\n branches:\n include:\n - main -> Option D
Quick Check:
Correct trigger syntax includes branches: include [OK]
Hint: Use 'branches: include:' to trigger on specific branches [OK]
Common Mistakes:
Using 'exclude' instead of 'include' to trigger
Confusing 'paths' with 'branches' in triggers
Omitting 'include' keyword causing syntax errors
3. Given this YAML snippet in an Azure build pipeline, what will be the output of the script step?
5. You want to create a build pipeline that triggers only when files in the 'src/' folder change on the 'release' branch. Which YAML snippet correctly sets this up?
hard
A. trigger:\n branches:\n include:\n - release\n paths:\n include:\n - src/**
B. trigger:\n branches:\n include:\n - release\n paths:\n exclude:\n - src/**
C. trigger:\n branches:\n exclude:\n - release\n paths:\n include:\n - src/**
D. trigger:\n branches:\n include:\n - main\n paths:\n include:\n - src/**
Solution
Step 1: Understand branch and path filters
To trigger on 'release' branch and only when files in 'src/' change, include 'release' in branches and 'src/**' in paths.
Step 2: Evaluate each option
trigger:\n branches:\n include:\n - release\n paths:\n include:\n - src/** correctly includes 'release' branch and 'src/**' path. trigger:\n branches:\n include:\n - release\n paths:\n exclude:\n - src/** excludes 'src/**' so it won't trigger on those files. trigger:\n branches:\n exclude:\n - release\n paths:\n include:\n - src/** excludes 'release' branch, so no trigger on it. trigger:\n branches:\n include:\n - main\n paths:\n include:\n - src/** triggers on 'main' branch, not 'release'.