fix: handle tag@sha256:digest image refs in pull API#200
Draft
Jasperhino wants to merge 1 commit intocoast-guard:mainfrom
Draft
fix: handle tag@sha256:digest image refs in pull API#200Jasperhino wants to merge 1 commit intocoast-guard:mainfrom
Jasperhino wants to merge 1 commit intocoast-guard:mainfrom
Conversation
The image reference parsers in both coast-daemon and coast-service used
rfind(':') to split image refs into (from_image, tag). For digest-pinned
refs like postgres:16.11-alpine3.23@sha256:23e88..., this splits at the
colon inside sha256:, producing a truncated from_image
(postgres:16.11-alpine3.23@sha256) and sending the bare hash as the tag.
Fix by detecting '@' in the reference first and passing the full ref as
from_image with an empty tag, which the Docker API handles correctly.
Adds tests for the tag@sha256:digest format in coast-daemon,
coast-service, and coast-docker.
Made-with: Cursor
Contributor
|
@Jasperhino do you have more to add to this or should I merge this? |
|
👋 Trying to use coasts and came across this issue too (filled #258). This fix would unblock our team. @Jasperhino would you mind if I rebase your branch and pick this up? Happy to keep your authorship via Co-Authored-By! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
coast-daemonandcoast-servicethat truncatedtag@sha256:digestrefs at the colon insidesha256:..., producing invalid Docker pull requests (e.g.,postgres:16.11-alpine3.23@sha256:with missing hash)@, the full reference is now passed asfrom_imagewith an empty tag, which the Docker API handles correctlytag@sha256:digestformat acrosscoast-daemon,coast-service, andcoast-dockerContext
coast buildemits warnings when pre-caching images that use thetag@sha256:digestformat in docker-compose.yml (e.g.,postgres:16.11-alpine3.23@sha256:23e88eb...). The root cause isrfind(':')/rsplit_once(':')splitting on the wrong colon — the one insidesha256:— instead of the tag separator. This produces a truncatedfrom_imageand a bare hash as thetagin the Docker pull API call.Images with just a tag (
emqx/emqx:6.0.1) or just a name (atmoz/sftp) are unaffected.Files changed
coast-daemon/src/handlers/build/utils.rsparse_pull_image_ref()that handles@before splitting on:coast-service/src/handlers/build/images.rsparse_image_ref()with same early@checkcoast-docker/src/image_cache.rs@correctlyTest plan
cargo test -p coast-docker -p coast-core -p coast-service)img@sha256:...), tag+digest (img:tag@sha256:...), registry+tag+digest (ghcr.io/org/app:v2.0@sha256:...), and registry-with-port (registry:5000/app:v1)coast buildno longer warns for digest-pinned images in docker-compose.ymlMade with Cursor