DevOps

Chapter 6
Continuous Delivery, Deployment, and Release Engineering

Bachelors Program in Computer Applications
DevOps   •   Bachelor

Continuous Delivery, Deployment, and Release Engineering

Introduction

Modern software users expect frequent improvements, rapid defect correction, and reliable digital services. Traditional release practices often accumulated changes for weeks or months before a large, manually coordinated deployment. Such releases were difficult to test, risky to operate, and expensive to reverse. DevOps addresses this problem by treating software delivery as an engineered flow from source code to a running service.

This chapter examines continuous delivery, continuous deployment, and release engineering. It explains how delivery pipelines are designed, how software is promoted between environments, and how organizations reduce release risk through automation, feature flags, database migration practices, rollback, blue-green deployment, canary release, and progressive delivery.

A central principle is that deployment is not merely the act of copying files to a server. It is a controlled change to a production system involving software, infrastructure, data, security, people, and business operations.

Learning Objectives

After studying this chapter, you should be able to:

  • distinguish continuous integration, continuous delivery, and continuous deployment;
  • design the stages and controls of a delivery pipeline;
  • explain release orchestration and environment promotion;
  • apply feature flags and safe database migration strategies;
  • compare rollback, roll-forward, blue-green, canary, and progressive delivery;
  • select release strategies according to risk, architecture, and organizational context;
  • evaluate delivery performance using meaningful engineering metrics;
  • identify governance, security, reliability, and ethical concerns in release management.

1. The Delivery and Release Problem

A software release has at least two dimensions. The first is deployment: placing a particular build into an environment. The second is release: making functionality available to users. These events may occur together, but they do not have to.

For example, a new payment capability can be deployed to production while hidden behind a feature flag. The code is present, but users cannot yet access it. Later, the organization may enable the feature for employees, then for 5% of customers, and finally for everyone. Separating deployment from release reduces the size of each operational decision.

A delivery system must answer several questions:

  1. What source revision produced this artifact?
  2. Has the artifact passed the required tests and security checks?
  3. In which environments has it run successfully?
  4. Who or what authorized promotion?
  5. How will the organization detect harm after release?
  6. How can service be restored if the change fails?

These questions establish traceability and make release engineering a socio-technical discipline rather than a collection of scripts.

2. Continuous Integration, Delivery, and Deployment

Continuous Integration

Continuous integration (CI) means that developers frequently merge changes into a shared repository and validate them through automated builds and tests. A CI pipeline commonly performs source checkout, dependency resolution, compilation or packaging, unit testing, static analysis, security scanning, and artifact creation.

CI does not guarantee that a system is ready for users. It primarily reduces integration uncertainty and detects defects near the time they are introduced.

Continuous Delivery

Continuous delivery means that every change that passes the required automated controls is maintained in a releasable state. The organization may still require a human approval or business decision before production release. The important property is that production deployment is a routine, low-drama operation rather than a special project.

Continuous Deployment

Continuous deployment extends continuous delivery by automatically deploying every qualifying change to production. It requires strong automated testing, observability, access controls, rollback or mitigation mechanisms, and confidence that the system can tolerate frequent change.

PracticeMain conditionProduction action
Continuous integrationChanges are frequently integrated and testedNo necessary production release
Continuous deliveryEvery accepted change is releasableProduction release may require approval
Continuous deploymentEvery accepted change is automatically releasedProduction release is automated

Continuous deployment is not inherently superior. A regulated medical system, for example, may require documented approvals even when its technical pipeline is highly automated. The appropriate goal is safe, observable, and repeatable delivery.

3. Delivery Pipeline Architecture

A delivery pipeline is a sequence of automated and controlled activities that transforms source code into a verified release. A representative pipeline is:

  1. Commit and trigger: A change is committed, reviewed, and associated with an issue or work item.
  2. Build: The system compiles or packages the software and resolves pinned dependencies.
  3. Unit and component tests: Fast tests examine local logic and service boundaries.
  4. Static quality and security analysis: Linters, type checkers, software composition analysis, and secret detection inspect the change.
  5. Artifact publication: A versioned, immutable artifact is stored in a repository.
  6. Integration testing: The artifact is tested with databases, queues, APIs, and other dependencies.
  7. Acceptance testing: Business or system-level behavior is verified.
  8. Environment deployment: The same artifact is installed in a test, staging, or production environment.
  9. Verification: Health checks, smoke tests, synthetic transactions, and observability signals confirm operation.
  10. Promotion or release: The artifact is promoted or functionality is enabled for a defined audience.

The principle of build once, deploy many is important. An artifact should be built once and then promoted unchanged through environments. Rebuilding separately for testing and production can introduce differences and undermine confidence in test results.

Pipeline Controls

A pipeline should include controls proportional to risk. Examples include:

  • mandatory peer review for protected branches;
  • reproducible builds and locked dependencies;
  • artifact checksums and provenance records;
  • vulnerability thresholds;
  • infrastructure and policy validation;
  • automated test evidence;
  • approval gates for high-risk changes;
  • separation of duties where required;
  • automatic expiration of temporary credentials;
  • audit logs for deployment and feature-flag changes.

A gate should have a clear purpose. Excessive manual gates create queues and encourage bypassing the pipeline; insufficient gates permit unsafe changes.

4. Artifacts, Versioning, and Traceability

An artifact is a deployable output such as a container image, package, binary, or infrastructure bundle. It should be identifiable by a version, source revision, build information, and dependency information. Mutable tags such as latest are dangerous because their meaning can change over time. Immutable identifiers, such as a digest or unique version, provide stronger traceability.

A useful release record connects:

requirement → source commit → build → tests → artifact → deployment → configuration → operational outcome

This chain supports incident investigation, compliance reporting, and reproducibility. It also helps determine whether a failure was caused by application code, infrastructure, configuration, data, or an external dependency.

Semantic versioning can communicate compatibility expectations using major, minor, and patch components, but version numbers do not replace testing. In distributed systems, compatibility must be considered at API, message, database, and operational levels.

5. Environment Promotion

Common environments include development, testing, staging, and production. Their purpose is not simply to represent organizational departments; each should provide evidence about a particular risk.

  • Development emphasizes rapid feedback and experimentation.
  • Test or integration examines interactions among components.
  • Staging approximates production sufficiently to reveal deployment and operational defects.
  • Production serves real users and requires the strongest monitoring and control.

Environment promotion should be based on evidence rather than elapsed time. A release may be promoted when tests pass, security findings are acceptable, service-level indicators remain healthy, and required approvals exist.

Environment parity is valuable but not absolute. Production may differ in scale, data sensitivity, network topology, or third-party integrations. Differences should be documented and tested explicitly. Production-like testing data must be anonymized or synthetically generated when personal or confidential information is involved.

6. Release Orchestration

Release orchestration coordinates multiple changes that must occur in a safe order. It is especially important for microservices, where a business capability may depend on several independently deployed components, schemas, queues, and infrastructure resources.

An orchestration plan should specify:

  • release scope and dependencies;
  • ordering constraints;
  • pre-release checks;
  • deployment and feature-activation steps;
  • monitoring thresholds;
  • owners and communication channels;
  • stop conditions;
  • rollback or roll-forward actions;
  • post-release verification.

A release train may group changes into scheduled windows, whereas independent deployment releases services whenever they are ready. Neither model is universally correct. Scheduling may help coordinate regulated or tightly coupled systems; independent deployment can reduce batch size and waiting time.

A good release plan also distinguishes technical completion from business activation. Code may be deployed first, configuration changed later, and a feature enabled only after customer support and operational teams are prepared.

7. Feature Flags and Decoupled Release

A feature flag is a runtime decision that controls whether a feature is available. Flags may be boolean, user-targeted, percentage-based, role-based, or environment-specific.

Feature flags support:

  • dark launches, in which code runs without being visible to users;
  • internal testing;
  • gradual exposure;
  • rapid disabling of a problematic capability;
  • experiments and controlled comparisons;
  • separation of deployment from release.

Flags introduce their own risks. A stale flag increases code complexity, and an incorrectly configured targeting rule can expose sensitive functionality. Each flag should have an owner, purpose, creation date, expected removal date, and audit history. Flag changes require access control and monitoring.

A flag is not a substitute for safe code. Hidden code still consumes resources, may affect shared data, and may contain security vulnerabilities. Both enabled and disabled paths should be tested where their behavior differs.

8. Database Migration and Data Compatibility

Database changes are often more difficult to reverse than application changes because data may have been transformed or written in a new format. A safe migration strategy generally separates schema evolution from feature activation.

The expand-and-contract pattern is widely applicable:

  1. Expand: Add new tables, columns, indexes, or fields without breaking the old application.
  2. Migrate: Copy or backfill data in controlled batches, if needed.
  3. Dual operation: Temporarily read or write both old and new representations, when necessary.
  4. Switch: Deploy code that uses the new representation and verify behavior.
  5. Contract: Remove obsolete structures only after all consumers have migrated.

For example, to rename a customer-name column, an application should not immediately delete the old column. It can add the new column, write both fields, backfill existing records, switch reads, and remove the old field in a later release.

Migrations should consider locking, transaction duration, indexing, replication lag, storage growth, and performance. Large backfills should be throttled and observable. A migration that is logically correct can still cause an outage if it exhausts database resources.

Backward and forward compatibility are essential in rolling deployments. During a transition, old and new application versions may run simultaneously. Messages and APIs should therefore tolerate the expected version combinations.

9. Rollback, Roll-Forward, and Recovery

Rollback restores a previous application version or configuration. It is effective when the previous version remains compatible with current data and external state.

Roll-forward fixes the defect by deploying a new version. It is often safer when the failed release changed a database schema, emitted irreversible events, or modified external resources. Reverting application code does not automatically revert data.

Recovery planning should identify:

  • the last known good artifact;
  • configuration and infrastructure versions;
  • database backup and restoration procedures;
  • feature-flag disablement;
  • communication responsibilities;
  • verification criteria;
  • limits on acceptable data loss or service interruption.

A useful reliability distinction is between recovery point objective (RPO) and recovery time objective (RTO). RPO describes the maximum acceptable amount of data loss, measured backward in time. RTO describes the maximum acceptable time to restore service. These are service requirements, not universal technical constants.

Rollback should be tested. An untested rollback plan is an assumption, not a capability.

10. Deployment Strategies

Recreate Deployment

The existing version is stopped before the new version starts. This approach is simple but may create downtime and is unsuitable for services requiring continuous availability.

Rolling Deployment

Instances are replaced gradually. The method can reduce resource requirements, but old and new versions coexist temporarily. Compatibility between versions is therefore essential.

Blue-Green Deployment

Two production environments exist: blue serves the current version and green contains the candidate version. After validation, traffic is switched to green. If a defect appears, traffic can be switched back to blue, provided data and external side effects remain compatible.

Blue-green deployment offers a clear traffic switch and strong isolation, but it may require nearly double infrastructure capacity. Database changes and stateful sessions can complicate reversal.

Canary Deployment

A canary release sends a small proportion of real traffic to the new version. Operators compare health indicators between canary and baseline instances before expanding exposure. The canary group should be selected carefully; a random or representative sample is generally more informative than only internal users.

Progressive Delivery

Progressive delivery is a broader approach that combines automation, observability, policy, and gradual exposure. A release may proceed through stages such as employees, 1%, 10%, 25%, 50%, and 100% of traffic. At each stage, the system evaluates predefined conditions.

Useful signals include error rate, latency, saturation, conversion, refund rate, and support contacts. Technical health alone may miss business harm. A release controller should stop or reverse promotion when a threshold is exceeded, while recognizing that correlation does not always prove causation.

StrategyMain strengthImportant limitation
RecreateSimple implementationDowntime and abrupt change
RollingEfficient resource useVersion coexistence complexity
Blue-greenFast traffic switchingHigher infrastructure cost and data concerns
CanaryReal-user validation with limited exposureRequires representative traffic and strong monitoring
ProgressiveFine-grained, policy-driven risk controlGreater operational and analytical complexity

11. Observability and Release Metrics

A release cannot be safely managed if its effects cannot be observed. Logs provide event detail, metrics provide numerical trends, and traces connect activity across distributed components. Health checks should test meaningful dependencies rather than merely confirm that a process is running.

The four commonly used delivery performance measures are:

  • Deployment frequency: how often an organization deploys successfully;
  • Lead time for changes: time from committed change to successful production operation;
  • Change failure rate: proportion of deployments causing a production failure, remediation, rollback, or hotfix;
  • Time to restore service: time required to recover after a production failure.

Metrics should be interpreted together. Increasing deployment frequency while change failure rate also increases may indicate that speed has been prioritized over quality. Local optimization can be misleading: a team that deploys rapidly may still create delays for dependent teams.

Release dashboards should include baseline comparison, version labels, deployment timestamps, and feature-flag state. Alert thresholds should be actionable and linked to an owner or automated response.

12. Security, Governance, and Ethics

Delivery automation expands the power of both legitimate operators and attackers. Pipeline credentials should be short-lived, minimally privileged, stored securely, and separated by environment. Secrets must not be committed to source repositories or printed in logs.

Software supply-chain controls include dependency verification, vulnerability scanning, signed artifacts, provenance information, restricted build environments, and review of third-party actions or plugins. These controls reduce, but do not eliminate, supply-chain risk.

Governance requirements may include approval records, segregation of duties, change tickets, retention of deployment evidence, and documented emergency procedures. Governance should enable safe delivery rather than encourage informal production changes outside the pipeline.

Ethical concerns arise when releases affect privacy, accessibility, safety, or fairness. A feature experiment must not silently disadvantage vulnerable groups. Personal data should not be used casually for testing or targeting. Automated release decisions should have human accountability, especially in domains such as healthcare, finance, education, and public services.

13. Applied Case: Illustrative Online Banking Release

Background

A fictional bank, RiverBank, operates a mobile transfer service. Its existing release process deploys a large bundle every six weeks. Releases require weekend maintenance, and failures have caused customer complaints and emergency database restoration.

Problem

The bank wants to introduce scheduled transfers while maintaining service availability. The change affects mobile applications, an API, a transaction database, notifications, fraud checks, and customer support procedures.

Analysis

The team identifies several risks:

  • old mobile clients may call the API after the new server is deployed;
  • scheduled-transfer records may require new database structures;
  • duplicate notifications could damage customer trust;
  • a fraud-rule error could block legitimate transactions;
  • rollback may not undo transactions already sent to an external payment network.

Approach

The team adopts continuous delivery with human approval for production. It builds one immutable API artifact and promotes it through test and staging environments. The database follows expand-and-contract migration. The new API accepts both old and new request formats. Scheduled transfers are initially hidden behind a feature flag.

A blue-green deployment is used for the API, while the database migration is performed before traffic switching. Employees test the feature first. A canary release then enables the feature for 2% of customers, selected across regions and account types. The system compares error rates, latency, duplicate-notification counts, fraud declines, and support contacts against the baseline.

Promotion is halted automatically if the error rate exceeds the approved threshold or if duplicate notifications occur. If the API is defective, traffic can return to blue. If the defect concerns data already written, the feature is disabled and a forward-fix procedure is used rather than blindly restoring the application version.

Outcome

The staged release reveals that one notification provider rejects a new message field. The team disables the feature for affected customers, corrects the integration, and resumes at the previous canary stage. No general outage occurs, and the database remains compatible with both versions.

Learning Points

The case demonstrates that safe release depends on more than deployment automation. It requires compatibility design, feature control, representative exposure, observability, clear stop conditions, and recovery decisions appropriate to data and external side effects.

14. Implementation Best Practices

  1. Keep changes small and independently releasable.
  2. Build once and promote the same immutable artifact.
  3. Treat pipeline definitions and infrastructure as version-controlled code.
  4. Automate fast feedback first, then add deeper tests at later stages.
  5. Design APIs, events, and schemas for transitional compatibility.
  6. Separate deployment from feature activation when risk is significant.
  7. Define release success and abort criteria before deployment begins.
  8. Monitor technical and business indicators together.
  9. Give every feature flag an owner and removal plan.
  10. Test rollback, restoration, and disaster procedures regularly.
  11. Protect pipeline identities and audit privileged actions.
  12. Conduct a blameless review after incidents and improve the system rather than merely assigning fault.

15. Challenges and Limitations

Automation does not remove complexity; it moves complexity into code, configuration, observability, and policy. Flaky tests reduce trust in gates. Environment differences produce false confidence. High deployment frequency can overwhelm support teams if communication and training are neglected. Canary analysis can fail when traffic is too small or metrics are poorly selected. Blue-green deployment can be impractical for stateful systems with expensive data synchronization.

There is also a human limitation: teams may interpret a green pipeline as proof that a release is safe, even though tests represent only selected scenarios. Professional judgment remains necessary. The correct objective is not maximum release speed but an acceptable balance among delivery flow, reliability, security, cost, and user impact.

Chapter Summary

Continuous integration frequently integrates and validates changes; continuous delivery keeps accepted changes releasable; continuous deployment automatically releases them to production. A delivery pipeline should produce immutable, traceable artifacts and promote the same artifact through environments using evidence-based controls.

Release engineering separates deployment from user-visible release through mechanisms such as feature flags and staged exposure. Safe database evolution commonly uses expand-and-contract migration, because application rollback cannot reliably undo irreversible data changes. Rollback, roll-forward, and feature disablement are distinct recovery techniques.

Recreate, rolling, blue-green, canary, and progressive delivery strategies offer different trade-offs in availability, cost, compatibility, and operational complexity. Effective release management depends on observability, meaningful delivery metrics, supply-chain security, governance, and ethical accountability. The most mature systems make change routine, measurable, reversible where possible, and continuously improved through evidence.

Key Terms

Continuous integration: Frequent integration of code changes with automated validation.

Continuous delivery: Practice of keeping every accepted change in a releasable state.

Continuous deployment: Automatic production release of every qualifying change.

Delivery pipeline: Automated and controlled workflow from source change to deployment.

Artifact: A versioned deployable output such as a package, binary, or container image.

Environment promotion: Advancing an artifact through environments after required evidence is obtained.

Release orchestration: Coordination of dependent technical and organizational release activities.

Feature flag: Runtime control that determines whether functionality is available.

Expand-and-contract: Database migration pattern that adds compatible structures before removing obsolete ones.

Rollback: Restoration of a previous application, configuration, or deployment state.

Roll-forward: Correction of a failed release by deploying a subsequent version.

Blue-green deployment: Operation of two environments with controlled traffic switching between them.

Canary release: Limited exposure of a new version to a selected portion of real traffic.

Progressive delivery: Gradual, observable, and policy-controlled expansion of release exposure.

Observability: Ability to infer system state from metrics, logs, traces, and other evidence.

RPO: Maximum acceptable amount of data loss expressed as a time interval.

RTO: Maximum acceptable time to restore service after disruption.

Change failure rate: Proportion of deployments that cause failure or require remediation.

Supply-chain security: Protection of code, dependencies, tools, artifacts, and build processes.

Review Questions

Short Answer Questions

  1. What is the principal difference between continuous delivery and continuous deployment?
  2. Why is the build-once, deploy-many principle useful?
  3. What is the purpose of a feature flag?
  4. Why can a database migration make rollback difficult?
  5. Name two signals that should be monitored during a canary release.

Long Answer Questions

  1. Explain the stages of a delivery pipeline and the evidence expected at each stage.
  2. Compare blue-green, rolling, and canary deployment strategies.
  3. Describe the expand-and-contract approach to database migration with an example.
  4. Explain how release orchestration supports multi-service systems.
  5. Discuss the security, governance, and ethical risks of automated production delivery.

Analytical / Application Questions

  1. A team can deploy frequently, but its change failure rate is increasing. Analyze possible causes and propose improvements to the pipeline and release process.
  2. Design a progressive delivery plan for a new payment feature that changes both an API and a database. Identify compatibility, monitoring, stop, and recovery conditions.
  3. A failed release has already written data in a new format and sent messages to an external system. Decide whether rollback or roll-forward is more appropriate and justify your decision.

Multiple Choice Questions with Answers

Question 1

Which statement best distinguishes continuous delivery from continuous deployment?

A. Continuous delivery requires no automated tests.

B. Continuous delivery keeps changes releasable, while continuous deployment automatically releases qualifying changes to production.

C. Continuous delivery applies only to infrastructure.

D. Continuous deployment means deploying only once per project.

Correct Answer: B. Continuous delivery keeps changes releasable, while continuous deployment automatically releases qualifying changes to production.

Question 2

What does the build-once, deploy-many principle recommend?

A. Rebuild the software separately for every environment.

B. Deploy source code directly without an artifact.

C. Promote the same immutable artifact through environments.

D. Use a mutable latest tag for every release.

Correct Answer: C. Promote the same immutable artifact through environments.

Question 3

Which database migration sequence is associated with expand-and-contract?

A. Delete old structures, then add new structures.

B. Add compatible structures, migrate or switch usage, then remove obsolete structures.

C. Stop all applications permanently before every schema change.

D. Restore a database backup after every deployment.

Correct Answer: B. Add compatible structures, migrate or switch usage, then remove obsolete structures.

Question 4

What is a principal benefit of a feature flag?

A. It eliminates the need for testing.

B. It separates deployment of code from activation of functionality.

C. It guarantees that database changes are reversible.

D. It prevents all unauthorized source changes.

Correct Answer: B. It separates deployment of code from activation of functionality.

Question 5

In a blue-green deployment, what normally happens after the candidate environment is validated?

A. All environments are deleted.

B. Traffic is switched from the current environment to the candidate environment.

C. The database is always restored from backup.

D. The candidate is permanently limited to one user.

Correct Answer: B. Traffic is switched from the current environment to the candidate environment.

Question 6

What is the defining characteristic of a canary release?

A. The new version receives a limited portion of real traffic before wider rollout.

B. The old version is never kept available.

C. Testing occurs only on developers’ laptops.

D. All users receive the change simultaneously.

Correct Answer: A. The new version receives a limited portion of real traffic before wider rollout.

Question 7

Which statement about rollback is most accurate?

A. Rolling back application code always reverses database and external side effects.

B. Rollback restores a previous state, but may be unsafe when data or external effects are incompatible.

C. Rollback and roll-forward are identical terms.

D. Rollback eliminates the need for monitoring.

Correct Answer: B. Rollback restores a previous state, but may be unsafe when data or external effects are incompatible.

Question 8

Which metric measures the proportion of deployments that cause failure or require remediation?

A. Deployment frequency

B. Lead time for changes

C. Change failure rate

D. Availability budget

Correct Answer: C. Change failure rate

Question 9

Why must old and new application versions often be compatible during a rolling deployment?

A. They may coexist while instances are replaced gradually.

B. Rolling deployments never use databases.

C. Compatibility reduces artifact storage costs only.

D. Only the old version receives traffic.

Correct Answer: A. They may coexist while instances are replaced gradually.

Question 10

Which practice best supports pipeline security?

A. Store permanent administrator credentials in source code.

B. Print secrets in deployment logs for troubleshooting.

C. Use least-privilege, short-lived credentials and audit privileged actions.

D. Allow every developer to bypass all pipeline controls.

Correct Answer: C. Use least-privilege, short-lived credentials and audit privileged actions.

DevOps
Chapter 6 of 15