CI/CD Interview Questions
8 questions for junior, mid-level and senior CI/CD interviews, with model answers, code examples and common mistakes. Answer each one out loud first, then reveal the answer.
CI/CD Pipeline Stages
// interview question
What are the typical stages of a CI/CD pipeline and why is each stage important?
Sample answer
A typical CI/CD pipeline has four main stages: Build (compile code, install dependencies), Test (run unit, integration, and security tests), Deploy (release to staging/production), and Monitor (track application health). Each stage must pass before proceeding. Failed tests block deployment, preventing bugs from reaching production.
Why this matters
CI/CD pipelines automate the path from code commit to production. Each stage serves as a quality gate - if any step fails, the pipeline stops, ensuring only validated code reaches users. This automation reduces manual errors and enables faster, safer releases.
Code examples
GitHub Actions pipeline
name: CI/CD Pipeline
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- name: Deploy to production
run: ./deploy.shCommon mistakes to avoid
- Skipping tests to deploy faster (technical debt)
- Not having proper staging environments for pre-production testing
- Missing rollback procedures when deployments fail
Likely follow-ups
- What is the difference between continuous integration and continuous deployment?
- How do you handle database migrations in a CI/CD pipeline?
- What testing should be automated vs manual in a pipeline?
Answer out loud first, then check yourself against the model answer.
Progressive Delivery Basics
// interview question
What is progressive delivery and how does it differ from traditional continuous delivery?
Sample answer
Progressive delivery is an extension of continuous delivery where new versions are released to a small subset of users first, then gradually rolled out to the full user base while monitoring for problems. Traditional CD typically deploys to all users at once after passing automated tests. Progressive delivery adds a controlled exposure phase between 'deployed' and 'released to everyone.' You ship the code to production but control who sees it using feature flags, canary releases, or traffic splitting. If error rates spike or latency increases for the small group, you stop the rollout and roll back before most users are affected. The key idea is that deploying code and releasing features are two separate steps. You can deploy a feature to production on Monday but only enable it for 1% of users, watch the dashboards for a day, bump to 10%, then 50%, and finally 100%.
Why this matters
This question checks whether the candidate understands the core principle of progressive delivery: decoupling deployment from release. Strong candidates will mention the feedback loop between exposure and observability. Weak candidates will confuse it with blue-green deployments or describe it as just 'deploying slowly.'
Code examples
Basic feature flag config separating deploy from release
# feature-flags.yaml
flags:
new-checkout-flow:
enabled: true
rollout:
strategy: percentage
percentage: 5 # Only 5% of users see this
kill-switch: true # Instantly disable if something breaks
owner: payments-team
created: 2026-03-15Simple progressive rollout check in application code
from featureflag import client as ff
def checkout(user, cart):
if ff.is_enabled('new-checkout-flow', user_id=user.id):
return new_checkout_flow(user, cart)
else:
return legacy_checkout(user, cart)Common mistakes to avoid
- Describing progressive delivery as just 'slow deployments' without mentioning observability and feedback loops
- Confusing deploying code with releasing a feature to users
- Thinking feature flags alone are progressive delivery without the monitoring and gradual rollout process
Likely follow-ups
- What signals would you watch to decide whether to increase the rollout percentage?
- How is progressive delivery different from a canary deployment?
- What happens if you deploy a database migration but only 5% of users see the new feature?
Answer out loud first, then check yourself against the model answer.
Blue-Green Deployment Strategy
// interview question
What is a blue-green deployment, and what are its advantages and disadvantages compared to other deployment strategies?
Sample answer
Blue-green deployment maintains two identical production environments (blue and green). One serves live traffic while the other receives the new version. After testing, traffic switches to the updated environment. Advantages: instant rollback, zero downtime, and safe testing. Disadvantages: requires double resources and can be complex with databases.
Why this matters
Blue-green deployments provide a safety net for releases by keeping the previous version running until the new one is verified. This strategy is particularly valuable for critical applications where downtime or failed deployments have significant business impact.
Code examples
Kubernetes blue-green with services
# Blue deployment (current production)
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-blue
spec:
replicas: 3
selector:
matchLabels:
app: myapp
version: blue
template:
metadata:
labels:
app: myapp
version: blue
---
# Service pointing to blue
apiVersion: v1
kind: Service
metadata:
name: app-service
spec:
selector:
app: myapp
version: blue # Switch to 'green' after verification
ports:
- port: 80Switch traffic to green
# Update service selector to point to green
kubectl patch service app-service \
-p '{"spec":{"selector":{"version":"green"}}}'
# Rollback to blue if needed
kubectl patch service app-service \
-p '{"spec":{"selector":{"version":"blue"}}}'Common mistakes to avoid
- Not accounting for database schema changes that may break the old version
- Forgetting to warm up the new environment before switching traffic
- Not having proper health checks to verify the green environment before cutover
Likely follow-ups
- How do you handle database migrations in a blue-green deployment?
- What is the difference between blue-green and canary deployments?
- How would you implement blue-green deployments with AWS or other cloud providers?
Answer out loud first, then check yourself against the model answer.
CI/CD Pipeline Design
// interview question
How would you design a CI/CD pipeline for a microservices application? What stages would you include?
Sample answer
A comprehensive pipeline includes: 1) Build stage - compile code, install dependencies. 2) Test stage - unit tests, integration tests, code coverage. 3) Security scanning - SAST, dependency scanning, container scanning. 4) Artifact creation - build and push Docker images. 5) Deploy to staging - automated deployment with smoke tests. 6) Performance/E2E tests - load testing, end-to-end tests. 7) Deploy to production - with approval gates, canary or blue-green deployment. Include notifications, rollback mechanisms, and artifact versioning throughout.
Why this matters
Pipeline design impacts developer productivity, deployment frequency, and system reliability. A well-designed pipeline catches issues early, provides fast feedback, and enables confident production deployments. This is a core DevOps competency.
Code examples
GitHub Actions pipeline example
name: CI/CD Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: npm test
- name: Security scan
run: npm audit
deploy-staging:
needs: build-and-test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Deploy to staging
run: ./deploy.sh staging
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
environment: production
steps:
- name: Deploy to production
run: ./deploy.sh productionCommon mistakes to avoid
- Skipping tests to deploy faster
- Not having environment parity between staging and production
- Missing rollback mechanisms
Likely follow-ups
- How do you handle database migrations in a CI/CD pipeline?
- What is the difference between continuous delivery and continuous deployment?
- How do you implement rollback in your pipelines?
Answer out loud first, then check yourself against the model answer.
Canary Releases in Progressive Delivery
// interview question
You're deploying a new version of a critical payment service. Walk me through how you'd set up a canary release for it.
Sample answer
First, I'd deploy the new version alongside the current one but route only a small slice of traffic to it, say 2-5%. The canary gets real production traffic while the stable version handles the rest. I'd set up automated analysis on key metrics: error rate, p99 latency, and business metrics like payment success rate. These metrics would be compared between the canary and the stable version. If the canary's error rate is more than 0.5% higher or its p99 latency is more than 50ms worse, the rollout automatically stops and traffic shifts back to the stable version. If metrics look healthy after 15-30 minutes, I'd step up to 10%, then 25%, then 50%, and finally 100%, with the same automated checks at each step. For a payment service specifically, I'd also watch for downstream effects like increased charge disputes or webhook delivery failures. The whole process might take 2-4 hours for a low-risk change or a full day for something significant. Tools like Flagger or Argo Rollouts can automate the traffic shifting and metric analysis so you're not manually watching dashboards.
Why this matters
This scenario-based question forces the candidate to think through a real deployment instead of reciting definitions. Strong answers include specific metrics, thresholds, and time windows. Listen for whether they mention automated rollback, business-level metrics beyond just error rates, and how they'd size the initial canary percentage based on the service's criticality.
Code examples
Argo Rollouts canary strategy with automated analysis
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: payment-service
spec:
replicas: 10
strategy:
canary:
steps:
- setWeight: 5
- pause: { duration: 15m }
- analysis:
templates:
- templateName: payment-success-rate
- setWeight: 25
- pause: { duration: 15m }
- analysis:
templates:
- templateName: payment-success-rate
- setWeight: 50
- pause: { duration: 30m }
- setWeight: 100
canaryMetadata:
labels:
version: canary
stableMetadata:
labels:
version: stablePrometheus-based canary analysis template
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: payment-success-rate
spec:
metrics:
- name: error-rate
interval: 2m
failureLimit: 3
provider:
prometheus:
address: http://prometheus:9090
query: |
sum(rate(http_requests_total{
service="payment-service",
status=~"5..",
version="canary"
}[5m])) /
sum(rate(http_requests_total{
service="payment-service",
version="canary"
}[5m]))
successCondition: result[0] < 0.005 # Less than 0.5% error rateCommon mistakes to avoid
- Setting the initial canary percentage too high for a critical service, defeating the purpose of gradual rollout
- Only checking error rates without looking at latency, business metrics, or downstream service health
- Not waiting long enough at each step to collect statistically significant data
Likely follow-ups
- How would you handle a canary release for a service that processes async jobs instead of HTTP requests?
- What's the minimum amount of traffic you need through the canary before the metrics are statistically meaningful?
- How do you do canary releases when the change involves a database schema migration?
Answer out loud first, then check yourself against the model answer.
Feature Flag Types and Use Cases
// interview question
Can you walk me through the different types of feature flags and when you'd use each one?
Sample answer
There are four main types of feature flags, each serving a different purpose. Release flags control the rollout of new features to users. They're temporary and should be removed once the feature is fully released. Example: rolling out a new search UI to 10% of users first. Ops flags are operational toggles for runtime control. They're semi-permanent and used to manage system behavior without redeploying. Example: a kill switch to disable a non-critical service under heavy load. Experiment flags support A/B testing. Users are consistently placed in the same group so you can measure outcomes. Example: testing whether a one-click checkout increases conversion. Permission flags control access to features based on user attributes like subscription tier, region, or role. They're long-lived and tied to business logic. Example: premium features only available to paying users. The important thing is to treat release flags differently from the others. Release flags are technical debt the moment the rollout is complete. You should have a process to clean them up within days, not months.
Why this matters
This question reveals whether a candidate has practical experience with feature flags beyond basic on/off toggles. Look for awareness of flag lifecycle management, especially cleanup of release flags. Experienced candidates will mention that stale flags are a real operational risk and talk about how they've managed flag hygiene.
Code examples
LaunchDarkly-style flag definitions showing different types
# Release flag - temporary, remove after full rollout
new-payment-page:
type: release
variation: boolean
targets:
- percentage: 25
expiry: 2026-04-30 # Alert if still active after this date
# Ops flag - semi-permanent kill switch
disable-recommendations:
type: ops
variation: boolean
default: false # Flip to true during incidents
# Experiment flag - A/B test with consistent bucketing
checkout-button-color:
type: experiment
variation: ["blue", "green", "orange"]
bucketing: user-id # Same user always sees the same variant
# Permission flag - long-lived, tied to business rules
advanced-analytics:
type: permission
rules:
- attribute: plan
operator: in
values: ["pro", "enterprise"]Script to find stale feature flags that should be cleaned up
#!/bin/bash
# Find release flags older than 30 days that are at 100% rollout
# These are candidates for removal
echo "Stale release flags (fully rolled out > 30 days):"
for flag_file in flags/release-*.yaml; do
created=$(yq '.created' "$flag_file")
percentage=$(yq '.rollout.percentage' "$flag_file")
age_days=$(( ($(date +%s) - $(date -d "$created" +%s)) / 86400 ))
if [[ "$percentage" == "100" && "$age_days" -gt 30 ]]; then
echo " WARNING: $(basename $flag_file) - $age_days days old, 100% rolled out"
fi
doneCommon mistakes to avoid
- Treating all feature flags the same without distinguishing release flags from long-lived permission flags
- Never cleaning up release flags after full rollout, leading to code full of dead branches
- Not considering that experiment flags need consistent user bucketing to produce valid results
Likely follow-ups
- How would you prevent stale feature flags from piling up in your codebase?
- What's the risk of having hundreds of active feature flags at once?
- How do you test all the different flag combinations?
- Would you store feature flags in your code repo or use a dedicated service?
Answer out loud first, then check yourself against the model answer.
Feature Flag Architecture at Scale
// interview question
Your team has 200+ microservices and wants to adopt feature flags across all of them. How would you design the feature flag infrastructure?
Sample answer
I'd use a centralized feature flag service rather than having each team roll their own. The architecture has three layers. First, the management plane: a central service where teams define flags, set targeting rules, and configure rollout percentages. This is backed by a database and has a UI for non-engineers to manage flags too. Second, the evaluation layer: lightweight SDKs embedded in each service that evaluate flags locally. The SDKs pull flag definitions from the central service on startup and receive updates via streaming (SSE or WebSockets), not by polling. Evaluations happen in-memory with no network call per flag check, so latency impact is near zero. Third, the data plane: all flag evaluations emit events to a pipeline for analytics, audit trails, and debugging. You need to know which users saw which flag values and when. For resilience, the SDKs cache the last known flag state locally. If the flag service goes down, services keep running with the cached values. You also need a bootstrapping strategy for cold starts when the flag service is unreachable. I'd ship a default config baked into each deployment as a fallback. On the operational side, flag changes should go through the same review process as code changes. A single flag flip can affect all 200 services, so you need change tracking, approval workflows, and the ability to audit who changed what and when.
Why this matters
This question tests system design thinking and whether the candidate has dealt with feature flags beyond a single application. Look for awareness of the latency implications of remote flag evaluation, resilience when the flag service is unavailable, and governance concerns at scale. Strong candidates will talk about caching, local evaluation, and the blast radius of flag changes.
Code examples
Feature flag service deployment with caching and streaming
# flag-service/docker-compose.yaml
services:
flag-service:
image: your-org/flag-service:latest
ports:
- "8080:8080" # REST API for management
- "8081:8081" # SSE stream for real-time updates
environment:
DATABASE_URL: postgres://flags-db:5432/flags
REDIS_URL: redis://flags-cache:6379
AUDIT_LOG_TOPIC: flag-changes
depends_on:
- flags-db
- flags-cache
- kafka
flags-db:
image: postgres:16
volumes:
- flags-data:/var/lib/postgresql/data
flags-cache:
image: redis:7
# Cache for flag definitions - reduces DB load
# SDKs also maintain their own in-memory cacheSDK with local evaluation and resilient caching
import json
import threading
from pathlib import Path
class FeatureFlagClient:
def __init__(self, service_url, fallback_path="/etc/flags/defaults.json"):
self._flags = {}
self._lock = threading.Lock()
self._service_url = service_url
self._fallback_path = Path(fallback_path)
# Try to connect; fall back to cached/default config
try:
self._flags = self._fetch_flags()
self._start_streaming()
except ConnectionError:
self._flags = self._load_fallback()
def is_enabled(self, flag_key, user_id=None, attributes=None):
"""Evaluate flag locally - no network call."""
with self._lock:
flag = self._flags.get(flag_key)
if not flag:
return False
return self._evaluate(flag, user_id, attributes)
def _evaluate(self, flag, user_id, attributes):
if not flag["enabled"]:
return False
if flag["rollout"]["strategy"] == "percentage":
bucket = hash(f"{flag['key']}:{user_id}") % 100
return bucket < flag["rollout"]["percentage"]
return flag.get("default", False)
def _load_fallback(self):
"""Load baked-in defaults when flag service is down."""
if self._fallback_path.exists():
return json.loads(self._fallback_path.read_text())
return {}Audit trail query for flag change investigation
# Who changed the 'new-checkout' flag in the last 24 hours?
curl -s "http://flag-service:8080/api/audit" \
--header "Authorization: Bearer $TOKEN" \
--data-urlencode "flag=new-checkout" \
--data-urlencode "since=24h" | jq '.events[] | {
time: .timestamp,
user: .changed_by,
field: .field_changed,
old: .old_value,
new: .new_value
}'
# Output:
# {
# "time": "2026-04-01T14:23:00Z",
# "user": "alice@company.com",
# "field": "rollout.percentage",
# "old": "10",
# "new": "50"
# }Common mistakes to avoid
- Making a remote API call for every flag evaluation, adding latency to every request in the hot path
- No fallback strategy when the flag service is unavailable, causing all services to fail or default to wrong values
- Treating flag changes as less risky than code changes and skipping review and audit processes
Likely follow-ups
- What happens during a deployment if the feature flag service is completely down?
- How would you prevent a single bad flag change from causing a cascading failure across all 200 services?
- How do you handle feature flags that need to be consistent across multiple services in a single user request?
- Would you build this in-house or use a managed service like LaunchDarkly? What's the tradeoff?
Answer out loud first, then check yourself against the model answer.
Progressive Delivery Rollback Strategy
// interview question
Your team just enabled a new feature for 20% of users via feature flags, and your monitoring shows a 3x increase in p99 latency for those users. Walk me through exactly what you'd do in the next 10 minutes.
Sample answer
First, kill the flag immediately. Don't investigate first, don't wait for more data. Flip the flag to 0% rollout. This should take under 30 seconds if your flag system supports instant updates. With the flag off, confirm that p99 latency drops back to baseline. If it does, the bleeding has stopped and you can investigate calmly. If latency stays high even after disabling the flag, you have a bigger problem - the feature may have caused a state change (corrupted cache, filled a queue, triggered a slow database migration). In that case, check downstream systems: is a queue backing up, did the feature write bad data, is a connection pool exhausted? Next, send a quick incident notification to the team with what happened and that the flag is off. Then investigate the root cause. Pull up traces from the canary cohort. Compare slow requests against the baseline. Often the problem is an N+1 query, a missing index for a new query pattern, or an external API call that works fine at 1% but chokes at 20% traffic. Before re-enabling, fix the issue and test it. Don't just bump to 20% again. Restart at 2% and step up more slowly this time. Add the specific metric that caught this problem to your canary analysis automation so it triggers an automatic rollback next time.
Why this matters
This incident-response question tests composure and prioritization under pressure. The strongest signal is whether the candidate's first instinct is to stop the bleeding (disable the flag) before investigating. Weak candidates will say 'I'd look at the logs first' or try to debug while users are still affected. Also listen for awareness that disabling a flag doesn't always fix the damage if the feature caused side effects.
Code examples
Emergency flag kill and verification
# Step 1: Kill the flag immediately
curl -X PATCH "https://flags.internal/api/flags/new-checkout-flow" \
-H "Authorization: Bearer $FLAG_TOKEN" \
-d '{"rollout": {"percentage": 0}}'
# Step 2: Verify latency is recovering
# Check p99 over last 5 minutes vs previous hour
curl -s "http://prometheus:9090/api/v1/query" \
--data-urlencode 'query=
histogram_quantile(0.99,
rate(http_request_duration_seconds_bucket{
service="checkout"
}[5m])
)' | jq '.data.result[0].value[1]'
# Step 3: Check for lingering damage
# Queue depth - should be draining, not growing
curl -s "http://prometheus:9090/api/v1/query" \
--data-urlencode 'query=
rabbitmq_queue_messages{queue="checkout-events"}' \
| jq '.data.result[0].value[1]'Automated rollback rule in Argo Rollouts
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: latency-check
spec:
metrics:
- name: p99-latency
interval: 1m
count: 5
failureLimit: 2 # 2 failures out of 5 checks = auto rollback
provider:
prometheus:
address: http://prometheus:9090
query: |
histogram_quantile(0.99,
rate(http_request_duration_seconds_bucket{
service="checkout",
version="canary"
}[2m])
)
# Fail if canary p99 is more than 3x the stable version
successCondition: "result[0] < 0.9"
failureCondition: "result[0] >= 0.9"Post-incident: automated flag rollback on metric breach
# progressive_delivery/auto_rollback.py
import requests
from prometheus_client import CollectorRegistry
def check_and_rollback(flag_key, metric_query, threshold, flag_service_url):
"""Auto-disable flag if metric exceeds threshold."""
result = requests.get(
"http://prometheus:9090/api/v1/query",
params={"query": metric_query}
).json()
current_value = float(result["data"]["result"][0]["value"][1])
if current_value > threshold:
# Kill the flag
requests.patch(
f"{flag_service_url}/api/flags/{flag_key}",
json={"rollout": {"percentage": 0}},
headers={"Authorization": f"Bearer {FLAG_TOKEN}"}
)
# Alert the team
requests.post(SLACK_WEBHOOK, json={
"text": f":rotating_light: Auto-rolled back flag `{flag_key}`. "
f"Metric breached threshold: {current_value:.2f} > {threshold}"
})
return False
return TrueCommon mistakes to avoid
- Trying to debug the issue before disabling the flag, leaving users impacted while investigating
- Assuming that disabling the flag fully reverts the system, ignoring state changes like database writes or queue messages
- Re-enabling the flag at the same percentage after fixing the bug instead of starting the rollout over from a small percentage
Likely follow-ups
- What if the feature flag service itself is down and you can't disable the flag remotely?
- How would you handle a rollback if the feature wrote data in a new format that the old code can't read?
- At what rollout percentage would you trust automated rollback versus requiring a human decision?
Answer out loud first, then check yourself against the model answer.
More interview topics
Also worth your time on this topic
CI/CD Pipeline Setup Checklist
Step-by-step checklist for a production-ready CI/CD pipeline: source control, builds, tests, security scans, deploy gates, secrets, and rollback paths.
1-2 hours
Deployment Strategies: Blue-Green vs Canary vs Rolling
Blue-green, canary and rolling deployments side by side: how each ships a release, how fast it rolls back, what it costs, and when to use which one.
GitOps with ArgoCD - Automated Kubernetes Deployments
Implement GitOps workflows using ArgoCD for automated, declarative, and auditable Kubernetes application deployments.
120 minutes