Skip to content

Commit 1d9912d

Browse files
Mark AllenCopilot
authored andcommitted
Gate digest suppression on comparable tags only
Non-comparable tags (e.g., 'latest', distro codenames like 'artful') should still receive digest updates since they cannot be version-compared. Only versioned/comparable tags get digest-only suppression. Adds test for non-comparable tag+digest pin scenario. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a067c8c commit 1d9912d

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

docker/lib/dependabot/docker/update_checker.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ def digest_up_to_date?
217217
# When digest-only updates are suppressed and the tag hasn't changed,
218218
# treat the digest as up-to-date to avoid proposing a PR that only
219219
# bumps the digest without a corresponding version change.
220+
# Only apply to comparable (versioned) tags — non-comparable tags like
221+
# "latest" or distro codenames should still get digest updates.
220222
if Dependabot::Experiments.enabled?(:docker_digest_only_update_suppression) &&
223+
Tag.new(source_tag).comparable? &&
221224
latest_tag.name == source_tag
222225
next true
223226
end

docker/spec/dependabot/docker/update_checker_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3310,6 +3310,25 @@ def stub_tag_with_no_digest(tag)
33103310
expect(digest_up_to_date?).to be false
33113311
end
33123312
end
3313+
3314+
context "when the tag is non-comparable (e.g., 'latest' or distro codename) with digest" do
3315+
let(:version) { "artful" }
3316+
let(:source) do
3317+
{
3318+
tag: "artful",
3319+
digest: "old_digest_that_differs_from_registry"
3320+
}
3321+
end
3322+
3323+
before do
3324+
stub_request(:head, repo_url + "manifests/artful")
3325+
.and_return(status: 200, headers: JSON.parse(headers_response))
3326+
end
3327+
3328+
it "still detects digest changes (suppression only applies to versioned tags)" do
3329+
expect(digest_up_to_date?).to be false
3330+
end
3331+
end
33133332
end
33143333

33153334
context "when experiment is disabled" do

0 commit comments

Comments
 (0)