A successful pipeline tells you that its configured jobs passed. Safe delivery also depends on knowing what reached an environment, who could authorize the change, and how to restore service if the result is wrong.
A release identifies a version of the software and its related assets. A deployment records an attempt to put a commit into an environment. Recovery restores the service people rely on, including its data, configuration, and dependencies. Keeping these events connected helps a team understand what happened without treating them as interchangeable.
Keep the path to production understandable
Follow an ordinary change and an urgent one-line fix through review, build, testing, approval, and deployment. Include the registries, artifacts, and external tools involved. This often reveals delays or alternate paths that aren't visible in the main pipeline file.
Choose a branching model that fits how you deliver and support releases. Short-lived feature branches reduce the distance between development and integration. Maintaining several supported releases can justify release branches, but it also creates work to carry fixes between them. Before adding another branch, be clear about the delivery need it serves.
Use workflow:rules to decide which pipelines are created and job rules to select deployment work within them. Protect the changes that can reach production and keep the exact commit and artifact associated with each deployment. A protected tag controls who can create or delete that tag; the tag itself doesn't establish whether a deployment happened.
Declare an environment for deployment jobs and set deployment_tier so a custom environment name still has the intended meaning. GitLab can then keep deployment history with the commit, job, and status. If another system performs the deployment, use the Deployments API to record its result. Compare the recorded artifact with what the environment is running when investigating drift or a failed release.
Control who can deploy and when
Production access deserves its own decision. Protected environments restrict deployers, and deployment approvals can require review before a deployment proceeds.1 Approval doesn't start the job; someone still needs to run it. Make that handoff clear so an approved urgent fix doesn't sit unnoticed.
Concurrent pipelines can race even when each deployment works on its own. A shared resource_group serializes jobs that target the same resource, while outdated-job protection helps stop an older deployment from replacing a newer one. These controls solve different problems, so check the result when two pipelines overlap.
Scope deployment credentials to the environments that need them and review who can read or change them. A separate deployment project can support different permissions for production access, provided application developers don't inherit the same elevated access there.
A deploy freeze schedule exposes CI_DEPLOY_FREEZE to the pipeline. Add and test the rule or job behavior that prevents deployment during the freeze. Document and review the route for urgent work if your operating process allows an exception, and retain the deployment record for that route too.
Prepare the recovery you can actually perform
Rolling back a GitLab deployment creates a new deployment at an earlier commit and reruns its deployment job. Earlier build jobs and Terraform plan jobs aren't automatically rerun. Keep the artifacts needed for the recovery window, or establish how to regenerate and validate them. If the project disallows job retries for rollback, the recovery path requires a new pipeline at the earlier commit.
Consider the state around the application as well as the application version. A database migration may have removed data the earlier version expects. A configuration change, feature flag, or dependency update may make that version unsuitable. After an irreversible change, a forward fix can be safer than redeploying old code.
Practice restoring service and measure how long it takes. Check the user-visible result and any data repair, not just the deployment job status. If recovery is automatic, test the failure that triggers it and the availability of everything the earlier deployment requires.
Approvals, serialization, and artifact retention all carry costs. Match them to the consequences of a failed change and the time the service can remain impaired. A practiced emergency path makes those tradeoffs easier to handle under pressure.
Use deployment and recovery planning to work through those choices for one service, from selecting the artifact to confirming that recovery restored the behavior users need.
Further Reading
Notes
-
Protected environments and deployment approvals are available in Premium and Ultimate. They let you restrict deployers and require approval before a deployment can proceed. ↩
- Control pipeline creation and choose when jobs run explain how to configure ordinary and urgent delivery paths.
- Configure deployment safety controls covers serialized deployments, outdated jobs, production secrets, and separate deployment projects.
- Set up deployment approvals explains approvers and the manual action after approval.
- Define deploy freeze behavior shows how the freeze variable affects deployment jobs.
- Retry or roll back a deployment explains what GitLab reruns and which earlier jobs you may need.
- Record deployments made by external tools provides the API for connecting external delivery to GitLab's history.