Skip to main content

Image Lifecycle Management

Purpose: For platform engineers, provides retention policies, deprecation process, and base image update cadence.

Overview​

Image lifecycle management covers how long images are kept, when they are deprecated, and how base images are updated. Harbor enforces retention rules per project; platform teams define deprecation timelines in release notes.

Retention Policies​

Harbor tag retention rules are configured per project. The platform uses these defaults:

Harbor ProjectRuleRetention PeriodRationale
platform-devKeep last 10 tags per repo30 days for untaggedFast iteration, limited storage
platform-stagingKeep last 5 tags per repo60 days for untaggedValidation window
platform-productionKeep all semver tags365 days minimumRollback capability, audit trail
customer-appsKeep last 20 tags per repo90 days for untaggedBalance between history and storage

Configuring Retention in Harbor​

Retention rules are set in each Harbor project under Policy > Tag Retention:

# Example Harbor tag retention policy (applied via Harbor API)
rules:
- action: retain
template: latestPushedK # Keep the K most recently pushed
params:
latestPushedK: 10
scope_selectors:
repository:
- kind: doublestar
decoration: repoMatches
pattern: "**"
tag_selectors:
- kind: doublestar
decoration: matches
pattern: "**"

Tagging Strategy​

Tag FormatExampleMutabilityUse Case
<semver>-<sha>1.4.2-a1b2c3dImmutableCI artifacts, audit trail
<semver>1.4.2Mutable (re-pointed on rebuild)Human reference, FluxCD ImagePolicy
latest—ProhibitedBlocked by Kyverno policy disallow-latest-tag

Deprecation Process​

When a platform service image is superseded or end-of-lifed:

  1. Announce — Add a deprecation notice to the release notes with the target removal date (minimum 90 days).
  2. Label — Apply the OCI annotation org.opencontainers.image.deprecated=true to the image manifest.
  3. Block promotion — Update the Harbor project's immutability rule to prevent the deprecated tag from being promoted to production.
  4. Remove — After the deprecation window, the image is deleted by the retention policy. A final SBOM snapshot is archived.

Base Image Update Cadence​

Base ImageSourceReview FrequencyTrigger
gcr.io/distroless/static-debian12GoogleWeekly (Dependabot)Digest change
golangDocker HubWeekly (Dependabot)Minor/patch release
pythonDocker HubWeekly (Dependabot)Minor/patch release
alpineDocker HubWeekly (Dependabot)Patch release

When a base image digest changes, Dependabot opens a PR. CI rebuilds all dependent images and runs the full scan pipeline. If scans pass, the PR is merged and images are promoted through the normal pipeline.

Version Pinning Requirements​

All references to images — in Dockerfiles, Helm values, and Kustomize patches — pin by digest or exact semver tag:

# Correct: pinned by digest in Dockerfile
FROM golang:1.22.4@sha256:abc123def456...

# Correct: pinned by semver in HelmRelease values
image:
repository: harbor.opencenter.example.com/platform-security/kyverno
tag: "1.12.0-a1b2c3d"

# Incorrect: mutable tag
image:
tag: "latest" # Rejected by Kyverno at admission

Further Reading​