DevOps CI/CD Pipelines 2 — Questions and Answers
Question 1: Which GitHub Actions component defines a workflow trigger?
- on: (Correct answer)
- trigger:
- event:
- start:
Correct answer: on:
The `on:` key in a GitHub Actions workflow YAML file specifies the events (push, pull_request, schedule, etc.) that trigger the workflow.
Question 2: What is a 'canary deployment'?
- Rolling out a new version to a small subset of users before full deployment (Correct answer)
- Deploying to a parallel environment and switching traffic instantly
- Running automated tests in a production-like environment
- Deploying to production only after manual sign-off
Correct answer: Rolling out a new version to a small subset of users before full deployment
A canary deployment gradually routes a small percentage of traffic to the new version to detect issues before rolling out to all users.
Question 3: In a CI/CD pipeline, what does 'shift-left testing' mean?
- Moving testing earlier in the development lifecycle (Correct answer)
- Running tests on the left side of a distributed system
- Prioritizing UI tests over unit tests
- Delaying tests until after deployment
Correct answer: Moving testing earlier in the development lifecycle
Shift-left testing means incorporating testing earlier in the software development lifecycle to find and fix defects sooner and at lower cost.
Question 4: What is the role of a 'build server' in a CI pipeline?
- To compile source code, run tests, and produce deployable artifacts automatically (Correct answer)
- To host the production application after deployment
- To monitor pipeline execution and alert on failures
- To store source code and manage version control
Correct answer: To compile source code, run tests, and produce deployable artifacts automatically
A build server automates the process of compiling code, running tests, and packaging artifacts whenever changes are pushed to the repository.
Question 5: What is 'pipeline as code'?
- Defining CI/CD pipeline configuration in version-controlled files (Correct answer)
- Writing pipeline logic in a programming language like Python
- Using infrastructure code to provision pipeline servers
- Automating code review processes through pipelines
Correct answer: Defining CI/CD pipeline configuration in version-controlled files
Pipeline as code means storing pipeline definitions in version-controlled files (like Jenkinsfile or .gitlab-ci.yml) so they are treated like application code.
Question 6: Which metric measures how frequently code is deployed to production in a CI/CD context?
- Deployment frequency (Correct answer)
- Mean time to recovery (MTTR)
- Change failure rate
- Lead time for changes
Correct answer: Deployment frequency
Deployment frequency, one of the four DORA metrics, measures how often an organization successfully releases to production.
Which GitHub Actions component defines a workflow trigger?