Skip to content

fix: stale-pin check should compare against the resolved release tag, not the raw hash - #8801

Open
weitzman wants to merge 1 commit into
ddev:mainfrom
weitzman:20260903_weitzman_dbimage_mismatch_release_tag
Open

fix: stale-pin check should compare against the resolved release tag, not the raw hash#8801
weitzman wants to merge 1 commit into
ddev:mainfrom
weitzman:20260903_weitzman_dbimage_mismatch_release_tag

Conversation

@weitzman

@weitzman weitzman commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Short Summary (TL;DR)

A pinned webimage/dbimage built from the official release image is reported stale even when it's current, because the check compares its label against the raw content-hash WebTag/BaseDBTag constant instead of the resolved release tag those same constants otherwise resolve to.

The Issue

The stale-pin warning added in #8682 (imageVersionMismatch) reads a pinned image's com.ddev.image-tag label and compares it to versionconstants.WebTag/BaseDBTag directly. Those are the raw content-hash autotag values (e.g. 27b956a558), not what a released DDEV actually expects.

On a release build, WebTagBranch/BaseDBTagBranch is a vX.Y.Z tag, and the official image DDEV publishes for that release is labeled with that readable tag (containers_shared.mk: DDEV_IMAGE_TAG defaults to VERSION, e.g. v1.25.4) - not the hash. So on DDEV v1.25.4, a dbimage built FROM ddev/ddev-dbserver-mysql-8.0:v1.25.4 (and therefore inheriting that image's v1.25.4 label) is reported as:

dbimage: ghcr.io/example/database:mytag (non-default, built for DDEV images v1.25.4 but this DDEV expects 27b956a558)

...even though the pin is exactly current. This defeats the purpose of the warning for anyone who follows the documented pattern of building a derived image FROM DDEV's official one.

Found via a project pinning the official ddev/ddev-dbserver-mysql-8.0:v1.25.4 as its dbimage base, immediately after v1.25.4's release.

How This PR Solves The Issue

docker.GetWebImage()/docker.GetDBImage() already resolve the default image tag correctly via docker.ResolveImageTag(tag, branch), which returns the branch when it's a release tag and the hash otherwise. imageVersionMismatch's two call sites in config_custom.go now compute their expectedTag the same way, instead of passing the raw constant.

This mirrors #8787 (merged 2026-09-01), which fixed the equivalent ddev version display path (TestCmdVersion) to go through docker.GetWebImage()/ResolveImageTag rather than the raw WebTag constant - the stale-pin check was the one place this pattern was missed.

Manual Testing Instructions

ddev config --db-image=ddev/ddev-dbserver-mysql-8.0:v1.25.4
ddev utility check-custom-config
# before: "built for DDEV images v1.25.4 but this DDEV expects <hash>"
# after: no staleness note, since v1.25.4 is what this DDEV expects
ddev config --db-image-default

Automated Testing Overview

  • TestCheckCustomConfigDBImageReleaseTag (new, pkg/ddevapp/config_custom_test.go): temporarily sets BaseDBTag/BaseDBTagBranch to simulate a release build, builds a local image labeled with the resolved release tag, and asserts CheckCustomConfig reports no staleness note. Runs in-process (not through the ddev binary as a subprocess) since it needs to observe the mutated versionconstants values.
  • TestUtilityCheckCustomConfigCmd/"dbimage built for a different DDEV version" (existing) updated to compare against docker.ResolveImageTag(...) instead of the raw constant, so it stays correct if this ever runs against a release-tagged test binary; behavior is unchanged for the normal (branch-tagged) CI case.

Release/Deployment Notes

None - this only removes a false positive from an existing check; the check still correctly flags an image genuinely built for a different DDEV image generation (covered by the existing test).

The stale-pin check added in ddev#8682 compared a pinned image's
com.ddev.image-tag label against the raw content-hash WebTag/BaseDBTag
constants, instead of docker.ResolveImageTag(tag, branch) - the same
resolution GetWebImage()/GetDBImage() already use to compute what a
default image actually is.

On a release build, TagBranch is a vX.Y.Z tag and ResolveImageTag
returns that readable tag instead of the hash, because that's the tag
DDEV's own release automation bakes into the label of the official
image it publishes (containers_shared.mk: DDEV_IMAGE_TAG defaults to
VERSION). So on DDEV v1.25.4, a dbimage built FROM (and therefore
inheriting the label of) the official
ddev/ddev-dbserver-mysql-8.0:v1.25.4 image was reported as "built for
DDEV images v1.25.4 but this DDEV expects 27b956a558" - a false
positive on a pin that is in fact current, undermining exactly the
warning ddev#8682 was meant to provide.

ddev#8787 (merged 2026-09-01) already fixed the equivalent `ddev version`
display path to go through docker.GetWebImage()/ResolveImageTag rather
than the raw WebTag constant; this applies the same fix to the
stale-pin check config_custom.go left behind.

Found via meprofilesvc's dbimage-based CI, which pins the official
v1.25.4 dbserver image, following v1.25.4's release.
@weitzman
weitzman requested a review from a team as a code owner September 3, 2026 11:40
@github-actions github-actions Bot added the bugfix label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Download this PR's build for your OS and architecture with:

ddev utility download-ddev --pr 8801

Or download the artifact for your OS and architecture directly:

See Testing a PR.

Open in GitHub Codespaces

@rfay

rfay commented Sep 3, 2026

Copy link
Copy Markdown
Member

Shucks, sorry to miss this!

@rfay

rfay commented Sep 3, 2026

Copy link
Copy Markdown
Member

Workaround for this problem until this goes into a release using build-and-push-seeded-image.sh example:

scripts/build-and-push-seeded-image.sh --push --snapshot=seed-mysql-97 --output-image=randyfay/mysql-97-tagbase:v1.25.4-fixed --project=~/workspace/d11 --base-image=ddev/ddev-dbserver-mysql-9.7:27b956a558

@rfay

rfay commented Sep 3, 2026

Copy link
Copy Markdown
Member

I manually tested this with randyfay/mysql-97-tagbase:v1.25.4, built from v1.25.4, and it worked fine, no warning.

rfay@rfay-mba-m4:~/workspace/d11$ ddev restart --reset-database -O -y
Removed database volume d11-mariadb
Restarting project d11...
[+] down 2/2
 ✔ Container ddev-d11-web   Removed                                                         0.3s
 ✔ Network ddev-d11_default Removed                                                         0.1s
[+] pull 34/34
 ✔ Image randyfay/mysql-97-tagbase:v1.25.4 Pulled                                           1.7s
Custom configuration detected in project 'd11':
  • DDEV version: v1.25.4-1-gbdb253dd7 (unsupported, not an official release)
  • Commands (global): /Users/rfay/.ddev/commands/host/hostenv
  • Config: /Users/rfay/workspace/d11/.ddev/config.db.yaml
  • Database: dbimage: randyfay/mysql-97-tagbase:v1.25.4 (non-default)

Custom configuration is updated on restart. Run 'ddev restart' if changes don't take effect.
Add '#ddev-silent-no-warn' comment to files if you don't want to see these warnings.
Building project images....
Project images built in 2s.
Initializing new database volume from /mysqlbase/custom/base_db.zst (5.6MB) baked into dbimage randyfay/mysql-97-tagbase:v1.25.4...
With a large database this may take a long time.
This may time out after 600 seconds

@rfay
rfay requested a review from stasadev September 3, 2026 18:19

@rfay rfay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great; really only touches CheckCustomConfig(), which is pretty safe anyway. Thanks! Sorry to have missed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants