DevOps Project for Your Resume: Full CI/CD on Google Cloud
What you build: a small web app with unit tests, a Dockerfile and a Cloud Build pipeline that tests, builds, deploys to Cloud Run as a candidate, promotes, rolls back and is monitored.

✍️ Translate this blog into Hindi, Tamil or Telugu
In this lab you build a complete DevOps project you can put on your resume: a small web app with unit tests and a Dockerfile, a CI/CD pipeline in Cloud Build that tests, builds and deploys it to Cloud Run, a safe release flow (new versions go out as a candidate with no traffic, then you promote them), a rollback in one command, and monitoring with an uptime check and an alert policy. You also watch the pipeline stop a real bug before it reaches users.
Who it is for: learners who know a little Git, Docker and Linux and want one end-to-end project to talk about in interviews. Time: about 2.5 to 3 hours the first time. Cost: a few cents. Cloud Build gives 2,500 free build-minutes a month on the default machine, Cloud Run has a monthly free tier, and our 3 builds took about 1 minute each. Delete everything at the end.
Every command below was run for real by the CareerByteCode Team on a fresh Google Cloud project, and every output and screenshot is the real result we got. We typed the commands in a Cloud Shell-like Linux VM (Debian with gcloud, git, curl and jq); Cloud Shell in your browser has the same tools ready.
Part A: CI/CD in plain English
CI (continuous integration) means every change is automatically tested and built as soon as it is committed. CD (continuous delivery or deployment) means a change that passed CI is automatically deployed. Together they replace "it works on my laptop, let me copy it to the server" with a repeatable, logged process.

Words you will use:
- Pipeline: the list of steps that run for every change, written in
cloudbuild.yaml. Real-life example: a factory line where quality control comes before packing. - Container image: your app plus everything it needs, built from a
Dockerfile, stored in Artifact Registry and tagged with the Git commit id, so you always know which code is running. - Revision: every deploy to Cloud Run makes a new, unchangeable revision. Traffic can be moved between revisions in seconds: that is how promote and rollback work.
- Candidate: a new revision with 0 percent of user traffic but its own test address (a tag). You test it there first.
- Service account: a Google identity for a program.
ci-builderruns the pipeline with only the roles it needs;resume-app-runruns the app and has no roles at all. - Uptime check: Google calls your
/healthaddress every minute from several places in the world. An alert policy turns failures into a notification.
What to write on your resume: "Built a CI/CD pipeline on Google Cloud (Cloud Build, Artifact Registry, Cloud Run) with unit-test gates, candidate releases with traffic promotion, one-command rollback, least-privilege service accounts and uptime monitoring with alerting."
Before you start
- A Google Cloud account (the free trial works) and a project with billing linked.
- Open Cloud Shell (the
>_icon at the top right of the Google Cloud console). - Set your project and turn on the APIs. Replace the text in quotes with your own project id:
export PROJECT_ID="your-project-id"
gcloud config set project $PROJECT_ID
gcloud services enable cloudbuild.googleapis.com artifactregistry.googleapis.com run.googleapis.com monitoring.googleapis.comMake a folder ~/resume-app with the files below (the same files we used). Three small ones first:
requirements.txt:
flask==3.1.*
gunicorn==23.*.dockerignore (keeps the tests and Git history out of the image):
tests/
.git/.gitignore:
__pycache__/
.pytest_cache/The project files
main.py, the app: a home page and a /health address that returns JSON with the version and commit id.
# resume-app: a tiny web service with a health check. Small on purpose: the project is the PIPELINE around it.
import os
from flask import Flask, jsonify
VERSION = "1.0.0"
app = Flask(__name__)
def greeting(name):
return f"Hello, {name.strip().title() or 'Guest'}!"
@app.get("/")
def home():
return f"<h1>resume-app {VERSION}</h1><p>{greeting('cloud learner')}</p><p>commit {os.environ.get('COMMIT', 'local')}</p>\n"
@app.get("/health")
def health():
return jsonify(status="ok", version=VERSION, commit=os.environ.get("COMMIT", "local"))tests/test_main.py, the unit tests:
# unit tests: Cloud Build runs these first; a failing test stops the pipeline before anything is deployed
from main import app, greeting
def test_greeting():
assert greeting(" asha ") == "Hello, Asha!"
assert greeting("") == "Hello, Guest!"
def test_health():
r = app.test_client().get("/health")
assert r.status_code == 200 and r.get_json()["status"] == "ok"Dockerfile, how to build the image (requirements.txt holds flask==3.1.* and gunicorn==23.*):
# small Python image; gunicorn serves the app on the port Cloud Run gives ($PORT)
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY main.py .
ENV PYTHONUNBUFFERED=1
CMD exec gunicorn --bind :$PORT --workers 1 --threads 4 main:appcloudbuild.yaml, the pipeline. Four steps: test (if pytest fails, nothing after it runs), build, push, deploy. $_SHA is the commit id and $_DEPLOY_FLAGS decides how the release goes out: by default as a candidate with no traffic.
# The CI/CD pipeline: 1 test, 2 build the image, 3 push it, 4 deploy to Cloud Run.
# By default a new release goes out as a "candidate" with NO traffic; you test it, then promote it.
steps:
- id: test
name: python:3.12-slim
entrypoint: bash
args: ["-c", "pip install -q -r requirements.txt pytest && python -m pytest -q"]
- id: build
name: gcr.io/cloud-builders/docker
args: ["build", "-t", "us-east1-docker.pkg.dev/$PROJECT_ID/resume-app/web:$_SHA", "."]
- id: push
name: gcr.io/cloud-builders/docker
args: ["push", "us-east1-docker.pkg.dev/$PROJECT_ID/resume-app/web:$_SHA"]
- id: deploy
name: gcr.io/google.com/cloudsdktool/cloud-sdk:slim
entrypoint: bash
args: ["-c", "gcloud run deploy resume-app --image=us-east1-docker.pkg.dev/$PROJECT_ID/resume-app/web:$_SHA --region=us-east1 --service-account=resume-app-run@$PROJECT_ID.iam.gserviceaccount.com --allow-unauthenticated --set-env-vars=COMMIT=$_SHA --max-instances=2 --quiet $_DEPLOY_FLAGS"]
images: ["us-east1-docker.pkg.dev/$PROJECT_ID/resume-app/web:$_SHA"]
substitutions:
_SHA: "manual"
_DEPLOY_FLAGS: "--no-traffic --tag=candidate"
options:
logging: CLOUD_LOGGING_ONLYPart B: the lab
Step 1: put the project under Git
Why: the pipeline builds what is committed, and the commit id becomes the image tag. In a real job this repo lives on GitHub or GitLab (see "Connect GitHub" below).
# put the project under Git: the app, its tests, the Dockerfile and the pipeline file
git config --global user.name "Lab Student"; git config --global user.email "lab@example.com"; git config --global init.defaultBranch main
cd ~ && rm -rf repo && cp -r resume-app repo && cd repo
git init -q && git add . && git commit -qm "resume-app 1.0.0 with tests, Dockerfile and pipeline"
git log --oneline
find . -path ./.git -prune -o -type f -print | sort179d280 resume-app 1.0.0 with tests, Dockerfile and pipeline
./.dockerignore
./.gitignore
./Dockerfile
./cloudbuild.yaml
./main.py
./requirements.txt
./tests/test_main.pyStep 2: an image repository and two service accounts
Why: least privilege. ci-builder gets exactly five roles: deploy to Cloud Run (run.admin), act as the runtime account (iam.serviceAccountUser), push images (artifactregistry.writer), write build logs (logging.logWriter) and read the uploaded source (storage.objectViewer). The app's own account gets nothing, because the app calls no Google API.
# an image repository and two service accounts: ci-builder runs the pipeline, resume-app-run runs the app (no roles)
gcloud artifacts repositories create resume-app --repository-format=docker --location=us-east1 --description="resume-app images" 2>&1 | tail -1
gcloud iam service-accounts create ci-builder --display-name="CI/CD pipeline" 2>&1 | tail -1
gcloud iam service-accounts create resume-app-run --display-name="resume-app runtime (no roles)" 2>&1 | tail -1
until gcloud iam service-accounts describe ci-builder@$PROJECT_ID.iam.gserviceaccount.com > /dev/null 2>&1; do sleep 5; done
for r in roles/run.admin roles/iam.serviceAccountUser roles/artifactregistry.writer roles/logging.logWriter roles/storage.objectViewer; do
gcloud projects add-iam-policy-binding $PROJECT_ID --member="serviceAccount:ci-builder@$PROJECT_ID.iam.gserviceaccount.com" \
--role=$r --condition=None --format="value(etag)" > /dev/null && echo "ci-builder: $r"
doneCreated repository [resume-app].
Service account email: ci-builder@your-project-id.iam.gserviceaccount.com
Service account email: resume-app-run@your-project-id.iam.gserviceaccount.com
Updated IAM policy for project [your-project-id].
ci-builder: roles/run.admin
Updated IAM policy for project [your-project-id].
ci-builder: roles/iam.serviceAccountUser
Updated IAM policy for project [your-project-id].
ci-builder: roles/artifactregistry.writer
Updated IAM policy for project [your-project-id].
ci-builder: roles/logging.logWriter
Updated IAM policy for project [your-project-id].
ci-builder: roles/storage.objectViewer
Step 3: release 1 through the whole pipeline
Why: gcloud builds submit uploads the folder and runs cloudbuild.yaml as ci-builder. For the very first release we pass _DEPLOY_FLAGS=--tag=first, so it takes all the traffic (Cloud Run cannot create a new service with no traffic). We wait 30 seconds first because new roles take a moment to spread.
# release 1: run the whole pipeline once from your Git repo; the first deploy takes all traffic
cd ~/repo
sleep 30
gcloud builds submit --config=cloudbuild.yaml --region=us-east1 \
--service-account=projects/$PROJECT_ID/serviceAccounts/ci-builder@$PROJECT_ID.iam.gserviceaccount.com \
--substitutions=_SHA=$(git rev-parse --short HEAD),_DEPLOY_FLAGS=--tag=first . 2>&1 | grep -E "passed|Successfully built|digest:|Service URL|ID |STATUS|SUCCESS|FAILURE" | head -8
URL=$(gcloud run services describe resume-app --region=us-east1 --format="value(status.url)")
curl -s $URL/; curl -s $URL/health; echoID CREATE_TIME DURATION SOURCE IMAGES STATUS
6580eff2-2968-4d56-88f0-6a3472fa960b 2026-11-18T18:53:32+00:00 1M5S gs://your-project-id_cloudbuild/source/1795028010.874171-638a5f8398ef40b1915cfab6c5b23db3.tgz us-east1-docker.pkg.dev/your-project-id/resume-app/web:179d280 SUCCESS
<h1>resume-app 1.0.0</h1><p>Hello, Cloud Learner!</p><p>commit 179d280</p>
{"commit":"179d280","status":"ok","version":"1.0.0"}
The image tag web:179d280 matches the commit, and /health reports the same commit: you can always trace what is running back to the code.
Step 4: release 2 as a candidate with no traffic
Why: never send a new version straight to all users. We change the greeting, commit, and run the pipeline with its default flags: --no-traffic --tag=candidate. Users still get 1.0.0; the candidate has its own address.
# release 2: change the code, commit, run the pipeline. It deploys a candidate with NO traffic
cd ~/repo
sed -i 's/VERSION = "1.0.0"/VERSION = "1.1.0"/; s/cloud learner/DevOps learner/' main.py
git commit -qam "1.1.0: new greeting" && git log --oneline -1
gcloud builds submit --config=cloudbuild.yaml --region=us-east1 \
--service-account=projects/$PROJECT_ID/serviceAccounts/ci-builder@$PROJECT_ID.iam.gserviceaccount.com \
--substitutions=_SHA=$(git rev-parse --short HEAD) . 2>&1 | grep -E "passed|STATUS|SUCCESS|FAILURE" | head -4
URL=$(gcloud run services describe resume-app --region=us-east1 --format="value(status.url)")
CAND=$(gcloud run services describe resume-app --region=us-east1 --format="value(status.traffic[].url)" | tr ';' '\n' | grep candidate)
echo "live: $(curl -s $URL/health)"
echo "candidate: $(curl -s $CAND/health)"c1555ee 1.1.0: new greeting
ID CREATE_TIME DURATION SOURCE IMAGES STATUS
6f119ac7-71dc-4a86-874b-a60c08171e38 2026-11-18T18:54:52+00:00 1M9S gs://your-project-id_cloudbuild/source/1795028092.490156-aeac703688b84246b3a7fd9d3085e5da.tgz us-east1-docker.pkg.dev/your-project-id/resume-app/web:c1555ee SUCCESS
live: {"commit":"179d280","status":"ok","version":"1.0.0"}
candidate: {"commit":"c1555ee","status":"ok","version":"1.1.0"}Step 5: promote the candidate
Why: the candidate answered correctly, so move 100 percent of traffic to the newest revision. Both revisions stay; only the traffic moves.
# test passed on the candidate URL: promote it (100 percent of traffic to the newest revision)
gcloud run services update-traffic resume-app --region=us-east1 --to-latest --quiet 2>&1 | tail -1
URL=$(gcloud run services describe resume-app --region=us-east1 --format="value(status.url)")
curl -s $URL/health; echo
gcloud run revisions list --service=resume-app --region=us-east1 --format="table(name,active)" candidate (Deleting): https://candidate---resume-app-xd6hv2gfza-ue.a.run.app
{"commit":"c1555ee","status":"ok","version":"1.1.0"}
REVISION ACTIVE
resume-app-00002-yah yes
resume-app-00001-rey yes
Break it: a bug that fails a unit test
A developer changes .title() to .upper() in the greeting, which breaks the test that expects "Hello, Asha!".
# Break it: a bug that breaks a unit test. The pipeline stops at "test"; nothing is built or deployed
cd ~/repo
sed -i "s/.title() or 'Guest'/.upper() or 'Guest'/" main.py
git commit -qam "1.2.0: shout the name (bug)"
gcloud builds submit --config=cloudbuild.yaml --region=us-east1 \
--service-account=projects/$PROJECT_ID/serviceAccounts/ci-builder@$PROJECT_ID.iam.gserviceaccount.com \
--substitutions=_SHA=$(git rev-parse --short HEAD) . > build.log 2>&1
grep -E "^BUILD FAILURE|completed with status" build.log | head -2
BID=$(gcloud builds list --region=us-east1 --filter="status=FAILURE" --limit=1 --format="value(id)")
gcloud builds log $BID --region=us-east1 2>/dev/null | grep -E "FAILED|AssertionError|assert |failed,|passed" | head -6
gcloud builds list --region=us-east1 --limit=3 --format="value(id,status)" | awk '{print substr($1,1,8), $2}'
URL=$(gcloud run services describe resume-app --region=us-east1 --format="value(status.url)")
echo "still live: $(curl -s $URL/health)"🎓⭐ Recommended by CareerByteCode · Live trainingCloud & DevOps Live Cohort Internshipโน2,360See the training →BUILD FAILURE: Build step failure: build step 0 "python:3.12-slim" failed: step exited with non-zero status: 1
ERROR: (gcloud.builds.submit) build 758e21ec-bde4-4ae3-aa70-c3b2df0bd1c0 completed with status "FAILURE"
Step #0 - "test": > assert greeting(" asha ") == "Hello, Asha!"
Step #0 - "test": E AssertionError: assert 'Hello, ASHA!' == 'Hello, Asha!'
Step #0 - "test": tests/test_main.py:6: AssertionError
Step #0 - "test": FAILED tests/test_main.py::test_greeting - AssertionError: assert 'Hello, ASH...
Step #0 - "test": 1 failed, 1 passed in 0.17s
758e21ec FAILURE
6f119ac7 SUCCESS
6580eff2 SUCCESS
still live: {"commit":"c1555ee","status":"ok","version":"1.1.0"}
This is CI doing its job: build step 0 (test) failed, so steps 1 to 3 never ran, no image was pushed and users never saw the bug. The build log shows exactly which assertion failed. The pipeline uses CLOUD_LOGGING_ONLY (required for a custom service account), so the log is read with gcloud builds log instead of being streamed.
Fix it: revert the commit, and a rollback drill
Why: git revert adds a new commit that undoes the bad one, so history stays honest (the next pipeline run would ship the fixed code). Then we practise the most important production skill: rollback. One command moves all traffic back to release 1; another moves it forward again.
# Fix it: git revert the bad commit (history stays honest). Then a rollback drill: put release 1 back in one command
cd ~/repo
git revert --no-edit HEAD | head -1
grep -n "title() or" main.py
FIRST=$(gcloud run revisions list --service=resume-app --region=us-east1 --format="value(name)" | sort | head -1)
echo "release 1 is revision $FIRST"
gcloud run services update-traffic resume-app --region=us-east1 --to-revisions=$FIRST=100 --quiet 2>&1 | tail -1
URL=$(gcloud run services describe resume-app --region=us-east1 --format="value(status.url)")
echo "after rollback: $(curl -s $URL/health)"
gcloud run services update-traffic resume-app --region=us-east1 --to-latest --quiet > /dev/null 2>&1
echo "forward again: $(curl -s $URL/health)"[main 65738a9] Revert "1.2.0: shout the name (bug)"
10: return f"Hello, {name.strip().title() or 'Guest'}!"
release 1 is revision resume-app-00001-rey
candidate: https://candidate---resume-app-xd6hv2gfza-ue.a.run.app
after rollback: {"commit":"179d280","status":"ok","version":"1.0.0"}
forward again: {"commit":"c1555ee","status":"ok","version":"1.1.0"}
Rollback took seconds because Cloud Run did not rebuild anything: release 1's revision was still there. Practise this before you need it.
Step 6: monitoring with an uptime check and an alert
Why: a pipeline tells you the deploy worked; monitoring tells you the app keeps working. We create, through the Cloud Monitoring API, an uptime check that calls /health every 60 seconds from the USA, Europe and Asia Pacific and looks for "status":"ok", plus an alert policy that fires when the check fails. In the console the same things are under Monitoring > Uptime checks and Monitoring > Alerting. Add a notification channel (email, for example) to the policy to receive the alert.
# monitoring: an uptime check on /health every minute from 3 regions, and an alert policy when it fails
URL=$(gcloud run services describe resume-app --region=us-east1 --format="value(status.url)")
HOST=${URL#https://}
TOKEN=$(gcloud auth print-access-token)
cat > uptime.json <<EOF2
{"displayName": "resume-app health", "period": "60s", "timeout": "10s",
"monitoredResource": {"type": "uptime_url", "labels": {"host": "$HOST", "project_id": "$PROJECT_ID"}},
"httpCheck": {"path": "/health", "port": 443, "useSsl": true, "validateSsl": true},
"contentMatchers": [{"content": "\"status\":\"ok\"", "matcher": "CONTAINS_STRING"}],
"selectedRegions": ["USA", "EUROPE", "ASIA_PACIFIC"]}
EOF2
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
"https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/uptimeCheckConfigs" -d @uptime.json > uptime-out.json
CHECK_ID=$(jq -r '.name' uptime-out.json | sed 's#.*/##'); echo "uptime check created: $(jq -r '.displayName' uptime-out.json)"
cat > policy.json <<EOF2
{"displayName": "resume-app is down", "combiner": "OR",
"conditions": [{"displayName": "health check failing",
"conditionThreshold": {"filter": "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" AND metric.label.check_id=\"$CHECK_ID\" AND resource.type=\"uptime_url\"",
"comparison": "COMPARISON_GT", "thresholdValue": 1, "duration": "60s",
"aggregations": [{"alignmentPeriod": "1200s", "perSeriesAligner": "ALIGN_NEXT_OLDER", "crossSeriesReducer": "REDUCE_COUNT_FALSE", "groupByFields": ["resource.label.*"]}],
"trigger": {"count": 1}}}]}
EOF2
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
"https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/alertPolicies" -d @policy.json | jq -r '"alert policy created: " + .displayName + " (enabled " + (.enabled|tostring) + ")"'
echo "waiting 4 minutes for the first check results..."; sleep 240
START=$(date -u -d "-6 min" +%Y-%m-%dT%H:%M:%SZ); END=$(date -u +%Y-%m-%dT%H:%M:%SZ)
curl -s -G -H "Authorization: Bearer $TOKEN" "https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/timeSeries" \
--data-urlencode "filter=metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" AND metric.label.check_id=\"$CHECK_ID\"" \
--data-urlencode "interval.startTime=$START" --data-urlencode "interval.endTime=$END" \
| jq -r '.timeSeries[]? | .metric.labels.checker_location + ": " + ([.points[].value.boolValue|tostring] | join(" "))'uptime check created: resume-app health
alert policy created: resume-app is down (enabled true)
waiting 4 minutes for the first check results...
usa-virginia: true true true true true true true true true
usa-oregon: true true true true true true true
usa-iowa: true true true true true true true
eur-belgium: true true true true true true
apac-singapore: true true true true true true true true
Each true is one passed check from that location. If the app goes down, these turn false and the policy opens an incident.
Connect GitHub (not tested in this lab)
In a real setup the pipeline starts on every push instead of by hand. We did not connect a GitHub account in this lab, so these steps are not tested here: in the console open Cloud Build > Repositories, connect your GitHub repository (2nd gen), then Cloud Build > Triggers > Create trigger: event "Push to a branch", branch ^main$, configuration cloudbuild.yaml, service account ci-builder, and set _SHA to $SHORT_SHA. See CI/CD for Beginners: Build and Deploy on Every Git Push for a tested trigger walkthrough.
POC: prove it works
- Every release went through test, build, push and deploy in about 1 minute, with the image tagged by commit id.
- Release 2 ran as a candidate with no traffic, was tested on its own address, then promoted.
- A bug that broke a unit test was stopped at the test step; nothing was deployed.
- Rollback to release 1 and forward again took one command each.
- An uptime check from 5 locations and an alert policy watch
/health. - Two service accounts with least privilege; the app account has no roles.
Clean up (delete everything)
Why: images in Artifact Registry and source uploads in Cloud Storage cost a little every month, and an unused service account with deploy rights is a security risk.
# delete everything: alert policy, uptime check, service, images, build bucket, service accounts and their roles
TOKEN=$(gcloud auth print-access-token)
for p in $(curl -s -H "Authorization: Bearer $TOKEN" "https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/alertPolicies" | jq -r '.alertPolicies[]? | select(.displayName == "resume-app is down") | .name'); do
curl -s -X DELETE -H "Authorization: Bearer $TOKEN" "https://monitoring.googleapis.com/v3/$p" > /dev/null && echo "deleted alert policy"; done
for u in $(curl -s -H "Authorization: Bearer $TOKEN" "https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/uptimeCheckConfigs" | jq -r '.uptimeCheckConfigs[]? | select(.displayName == "resume-app health") | .name'); do
curl -s -X DELETE -H "Authorization: Bearer $TOKEN" "https://monitoring.googleapis.com/v3/$u" > /dev/null && echo "deleted uptime check"; done
gcloud run services delete resume-app --region=us-east1 --quiet 2>&1 | tail -1
gcloud artifacts repositories delete resume-app --location=us-east1 --quiet 2>&1 | tail -1
for b in $(gcloud storage buckets list --format="value(name)" | grep -E "cloudbuild|run-sources"); do gcloud storage rm -r gs://$b --quiet > /dev/null 2>&1 && echo "deleted bucket (build source uploads)"; done
for r in roles/run.admin roles/iam.serviceAccountUser roles/artifactregistry.writer roles/logging.logWriter roles/storage.objectViewer; do
gcloud projects remove-iam-policy-binding $PROJECT_ID --member="serviceAccount:ci-builder@$PROJECT_ID.iam.gserviceaccount.com" \
--role=$r --condition=None --format="value(etag)" > /dev/null; done; echo "removed ci-builder roles"
gcloud iam service-accounts delete ci-builder@$PROJECT_ID.iam.gserviceaccount.com --quiet 2>&1 | tail -1
gcloud iam service-accounts delete resume-app-run@$PROJECT_ID.iam.gserviceaccount.com --quiet 2>&1 | tail -1
cd ~ && rm -rf repo uptime*.json policy.json
echo "Cloud Run services left: $(gcloud run services list --format="value(name)" | wc -l)"
echo "repositories left: $(gcloud artifacts repositories list --format="value(name)" 2>/dev/null | wc -l)"
echo "uptime checks left: $(curl -s -H "Authorization: Bearer $TOKEN" "https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/uptimeCheckConfigs" | jq '.uptimeCheckConfigs // [] | length')"
echo "alert policies left: $(curl -s -H "Authorization: Bearer $TOKEN" "https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/alertPolicies" | jq '.alertPolicies // [] | length')"deleted alert policy
deleted uptime check
Deleted service [resume-app].
Deleted repository [resume-app].
deleted bucket (build source uploads)
Updated IAM policy for project [your-project-id].
Updated IAM policy for project [your-project-id].
Updated IAM policy for project [your-project-id].
Updated IAM policy for project [your-project-id].
Updated IAM policy for project [your-project-id].
removed ci-builder roles
deleted service account [ci-builder@your-project-id.iam.gserviceaccount.com]
deleted service account [resume-app-run@your-project-id.iam.gserviceaccount.com]
Cloud Run services left: 0
repositories left: 0
uptime checks left: 0
alert policies left: 0
FAQ
Why Cloud Run and not GKE? Cloud Run runs a container with no cluster to manage and scales to zero, so the project costs almost nothing. The same pipeline can deploy to GKE with kubectl or Cloud Deploy; GKE is worth learning next.
Why not deploy straight to 100 percent? Because tests never catch everything. A candidate with no traffic lets you test the real thing in production before users see it. For bigger apps, send 10 percent first (a canary): gcloud run services update-traffic --to-tags=candidate=10.
Where would secrets go? Never in the repo or cloudbuild.yaml. Store them in Secret Manager and pass them to Cloud Run with --set-secrets. See Secret Manager: Store Passwords and API Keys Safely.
How do I explain this in an interview? Walk through one commit: what runs, what stops a bad change, how you release safely, how you roll back, and how you would know it is down. Mention the least-privilege accounts. Show the repo and a screenshot of a passing and a failing build.
What should I add next to make it stand out? A second environment (staging), a security scan of the image (Artifact Analysis), infrastructure as code with Terraform, and a dashboard of request latency in Cloud Monitoring.
Why does the alert need a notification channel? The policy opens an incident in the console either way; a channel (email, SMS, Slack, PagerDuty) is how a person hears about it.
Troubleshooting
| You see | Why | Fix |
|---|---|---|
PERMISSION_DENIED at the deploy step | ci-builder lacks a role, or roles were still spreading | Check the five roles in Step 2; wait a minute and run again |
--no-traffic not supported when creating a new service | First release of a new service | Deploy the first release with traffic (we pass --tag=first) |
| Build fails with "logs bucket" or logging errors | Custom service accounts need a logging option | Keep options: logging: CLOUD_LOGGING_ONLY |
| Test step fails | A real bug, or a test that is wrong | Read gcloud builds log <id> --region=us-east1, fix, commit, run again |
/health works but the uptime check fails | Wrong host, path or content match | The check needs the host only (no https://), path /health and the exact text it looks for |
| Old version still served after a build | The new revision has no traffic (candidate) | Promote: gcloud run services update-traffic resume-app --to-latest |
What next
- The pipeline basics in more depth: Cloud Build Hands-On: Pipelines Without Managing Servers.
- Find errors fast when something breaks: Cloud Logging Hands-On: Find Any Error in Seconds.
- Get the Git skills interviewers ask about: Git for DevOps: Branches, Merges and Fixing Mistakes.
- Understand the roles you gave
ci-builder: Google Cloud IAM for Beginners. - More hands-on posts: ByteBlog. Practice in ByteLabs and see the courses.
Prepared by the CareerByteCode Team from our tested lab, with AI help for the write-up.
⭐ Keep learning with CareerByteCode
Hand-picked to go deeper on this topicGet CareerByteCode Team's next blog by email
One email a week when they publish. Add the weekly Best of ByteBlog too. No spam, unsubscribe with one click.
We email you once to confirm. By subscribing you agree to the privacy policy.
Related blogs
CareerByteCode TeamDevOps Interview Questions Answered with Real Pipelines
What you build: proof for 14 classic DevOps interview answers on Google Cloud: Docker layers, CI that stops a bug, secrets, digests, blue/green, canary, rollback, a failed deploy, least privilege.
#cicd
CareerByteCode TeamHelm Chart CI/CD: Lint, Test and Publish Charts Automatically
What you build: a Helm chart pipeline: lint, kubeconform, helm-unittest, then publish to Artifact Registry with immutable versions, plus a real failing test, a refused overwrite, and install/upgrade/r
#cicd
CareerByteCode TeamFlux CD vs Argo CD: Hands-On GitOps Comparison
What you build: Argo CD and Flux side by side on one GKE cluster from the same Git repo, with real numbers: footprint, time to apply a Git change, drift correction, and broken-commit handling.
#argo
CareerByteCode TeamArgo CD on Kubernetes: GitOps from Zero
What you build: a GKE cluster that deploys itself from Git with Argo CD, heals hand changes and rolls back with git revert, in your own Google Cloud account. Every step tested.
💬 Comments (0)
Top · NewestSign in to comment