Lesson 2 of 7 in DevOps and delivery fundamentals

The delivery lifecycle from plan to monitor

Core9 min

The delivery lifecycle is the set of stages a change passes through between an idea and a working feature that someone watches in production. The stages form a loop, because what you learn while monitoring becomes the next plan.

Draft. This lesson is written and waiting for a person to run every command and review it. It is safe to learn from, but check the official documentation for anything you depend on.

Read these first: What DevOps is and why teams adopted it

The problem this solves

Beginners meet DevOps as a pile of tool names: Git, Jenkins, Docker, Prometheus. Without a map, it is unclear why each tool exists or which problem it belongs to.

The lifecycle is that map. Every tool you will meet sits in one stage, and each stage answers one question: what are we doing, does it build, does it work, is it shipped, is it healthy.

How it works

Eight stages that loop back to planning
Eight stages that loop back to planningA work item is coded, built, tested, released as a version, deployed, operated and monitored, and what monitoring shows becomes the next plan.1 work item2 commit3 artifact4 passes5 version6 live7 metrics8 what we learnPlandecide the changeCodewrite and commitBuildmake an artifactTestcheck it worksReleasecut a versionDeployput it on serversOperatekeep it runningMonitorwatch the signals
  • People and clients
  • Control
  • Data
  • Runs code
  • Other

A work item is coded, built, tested, released as a version, deployed, operated and monitored, and what monitoring shows becomes the next plan.

  1. Plan to Code: 1 work item
  2. Code to Build: 2 commit
  3. Build to Test: 3 artifact
  4. Test to Release: 4 passes
  5. Release to Deploy: 5 version
  6. Deploy to Operate: 6 live
  7. Operate to Monitor: 7 metrics
  8. Monitor to Plan: 8 what we learn

Read the top row left to right, then the bottom row right to left. Plan decides what to change. Code writes it and commits it to version control. Build turns the source into something runnable, called an artifact, such as a package or a container image. Test checks that artifact.

Release gives a tested artifact a version, so you can say exactly which one is running. Deploy places that version on an environment. Operate is the ongoing work of keeping it healthy. Monitor collects metrics, logs and alerts, and step 8 feeds those back into planning.

Deploy and release are used loosely in the industry. In this track, release means creating a versioned, tested artifact and deploy means running it somewhere. Teams that use feature flags go one step further and deploy code switched off, then turn it on for users later.

Try it yourself

You will walk one change through the stages using only Git and the shell, in a throwaway repo. Linux, macOS or WSL.

  1. 1
    Plan and code: write the change and commit it
    mkdir -p ~/devops-lab/lifecycle && cd ~/devops-lab/lifecycle
    git init
    git config user.name "Learner"
    git config user.email "learner@example.com"
    echo "add a greeting script" > PLAN.txt
    echo 'echo hello' > greet.sh
    git add . && git commit -m "add greeting script"

    The local git config lines set an identity for this repo only. Skipping them can make the commit fail, as the first failure below shows.

  2. 2
    Build and test: check the syntax and the behaviour
    sh -n greet.sh && test "$(sh greet.sh)" = "hello" && echo "tests passed"

    You should see

    tests passed

    There is nothing to compile, so the build step is the syntax check. The test runs the script and compares its output with what you expect.

  3. 3
    Release: give the tested commit a version
    git tag v1.0.0
    git tag

    You should see

    v1.0.0

    A tag is a permanent name for one commit. From now on v1.0.0 always means exactly this code.

  4. 4
    Deploy: put that version in a target folder
    mkdir -p deployed
    git archive v1.0.0 greet.sh | tar -x -C deployed
    ls deployed

    You should see

    greet.sh

    git archive exports the files as they were at the tag, not your working folder. That is how a real pipeline avoids shipping uncommitted edits.

  5. 5
    Operate and monitor: run it and read its signal
    sh deployed/greet.sh
    echo "exit=$?"

    You should see

    hello
    exit=0

    The exit code is the simplest health signal. Real systems collect many more, but the idea is the same: observe, then decide what to change next.

What breaks, and where to look

  • git commit stops with: Author identity unknown *** Please tell me who you are.

    WHY IT HAPPENS
    Git records an author on every commit and no name or email is configured on this machine.
    CHECK FIRST
    Run git config user.name and git config user.email. If they print nothing, set them as in step 1.
  • A bug appears in production that you cannot reproduce from the repository.

    WHY IT HAPPENS
    The deployed files came from a working folder with uncommitted edits, not from a tagged commit, so production differs from anything in version control.
    CHECK FIRST
    Run git status and git describe --tags --always --dirty. A -dirty suffix means the tree has uncommitted changes. Deploy from the tag, as step 4 does.
  • The new code is deployed but users cannot see the feature, or users see unfinished work the moment it deploys.

    WHY IT HAPPENS
    Deploy and release were treated as one event. A feature flag, a gradual rollout setting or a cache sits between running code and what users see.
    CHECK FIRST
    Find where the feature is switched on, for example a flag in the app configuration, and check its value in that environment.

When not to use this

  • The eight stages are a teaching model. Real teams overlap them, and a library has no operate stage at all. Do not read the loop as eight separate teams passing work along.

Check yourself

Which stage turns source code into something runnable, and what is the output called?

Build. The output is an artifact, such as a package or a container image.

How are deploy and release different in this track?

Release creates a versioned, tested artifact. Deploy runs that version on an environment.

Why does the loop end at monitor and return to plan?

Signals from the running system show what to improve, and those findings become the next work item.

Lesson 2 of 92 in the DevOps path

Search

Search cheat sheets and projects