Skip to content

Commit

Permalink
Merge pull request dependabot#7842 from dependabot/deivid-rodriguez/d…
Browse files Browse the repository at this point in the history
…ebug-docker-prerelease-issues

Debug issues with docker prereleases
  • Loading branch information
deivid-rodriguez authored Aug 18, 2023
2 parents 73e3f76 + 7cfb93a commit 089a1b9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions docker/lib/dependabot/docker/update_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,14 @@ def remove_precision_changes(candidate_tags, version_tag)
end
end

def version_of_latest_tag
def latest_tag
return unless latest_digest

candidate_tag =
tags_from_registry.
tags_from_registry.
select(&:canonical?).
sort_by { |t| comparable_version_from(t) }.
reverse.
find { |t| digest_of(t.name) == latest_digest }

return unless candidate_tag

comparable_version_from(candidate_tag)
end

def updated_digest
Expand Down Expand Up @@ -259,10 +254,16 @@ def prerelease?(tag)
return true if tag.looks_like_prerelease?

# Compare the numeric version against the version of the `latest` tag.
return false unless latest_digest
return false unless version_of_latest_tag
return false unless latest_tag

if comparable_version_from(tag) > comparable_version_from(latest_tag)
Dependabot.logger.info "Tag with non-prerelease version name #{tag.name} detected as prerelease, " \
"because it sorts higher than #{latest_tag.name}."

comparable_version_from(tag) > version_of_latest_tag
true
else
false
end
end

def comparable_version_from(tag)
Expand Down

0 comments on commit 089a1b9

Please sign in to comment.