0
0
GCPcloud~10 mins

Revision management in GCP - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Revision management
Create initial revision
Deploy revision to service
Make changes to config/code
Create new revision
Deploy new revision
Traffic shifts to new revision
Optionally rollback to previous revision
Manage multiple revisions
Revision management tracks versions of deployed code/configuration, allowing updates and rollbacks safely.
Execution Sample
GCP
gcloud run deploy myservice --image gcr.io/myproject/myimage:v1
# Deploys revision-1

gcloud run deploy myservice --image gcr.io/myproject/myimage:v2
# Deploys revision-2

gcloud run services update-traffic myservice --to-revisions revision-1=100
# Rollback traffic to revision-1
Deploys two revisions of a Cloud Run service and rolls back traffic to the first revision.
Process Table
StepActionRevision CreatedTraffic AllocationResult
1Deploy service with image:v1revision-1revision-1=100%Service running revision-1
2Deploy service with image:v2revision-2revision-2=100%Service updated to revision-2
3Update traffic to revision-1nonerevision-1=100%Traffic rolled back to revision-1
4Deploy service with image:v3revision-3revision-3=100%Service updated to revision-3
5Split traffic between revision-3 and revision-1nonerevision-3=50%, revision-1=50%Traffic split between revisions
6Delete old revision-2noneunchangedrevision-2 removed
7No further changesnoneunchangedStable traffic and revisions
💡 No more changes; revisions managed with traffic control and cleanup
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5After Step 6Final
Revisionsnone[revision-1][revision-1, revision-2][revision-1, revision-2][revision-1, revision-2, revision-3][revision-1, revision-2, revision-3][revision-1, revision-3][revision-1, revision-3]
Trafficnonerevision-1=100%revision-2=100%revision-1=100%revision-3=100%revision-3=50%, revision-1=50%revision-3=50%, revision-1=50%revision-3=50%, revision-1=50%
Key Moments - 3 Insights
Why does deploying a new image create a new revision instead of replacing the old one?
Each deployment creates a new revision to keep history and allow rollback, as shown in steps 1, 2, and 4 where new revisions are created without deleting old ones.
How does traffic shifting work between revisions?
Traffic can be split or shifted fully between revisions without redeploying, as in step 5 where traffic is split 50/50 between revision-3 and revision-1.
What happens if you delete a revision that still has traffic?
Deleting a revision with traffic is not allowed or causes errors; traffic must be shifted away first, as shown in step 6 where revision-2 is deleted only after traffic moved away.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step is traffic rolled back to revision-1?
AStep 3
BStep 2
CStep 5
DStep 6
💡 Hint
Check the 'Traffic Allocation' column for 100% traffic to revision-1
According to variable_tracker, how many revisions exist after step 4?
A1
B3
C2
D4
💡 Hint
Look at the 'Revisions' row after step 4
If traffic was not shifted before deleting revision-2, what would happen?
ARevision-2 would be deleted successfully
BTraffic would automatically move to revision-1
CDeletion would fail or cause errors
DRevision-3 would be deleted instead
💡 Hint
Refer to key_moments about deleting revisions with traffic
Concept Snapshot
Revision management in GCP Cloud Run:
- Each deploy creates a new revision
- Traffic can be shifted or split between revisions
- Rollbacks done by shifting traffic back
- Old revisions can be deleted after traffic moves
- Enables safe updates and quick recovery
Full Transcript
Revision management in Google Cloud Platform involves creating new versions called revisions each time you deploy a service update. These revisions keep a history of your service states. You can control which revision receives user traffic, allowing you to shift traffic gradually or rollback to a previous version if needed. Deleting old revisions is possible only after traffic is moved away from them. This process ensures safe updates and easy recovery from issues.