Add [DockerLastUpdated] badge for newest image date - #12105
Conversation
|
| }) | ||
|
|
||
| t.create('docker last updated (valid, user)') | ||
| .get('/datadog/dogstatsd.json') |
| return { date: data.last_updated } | ||
| } | ||
| if (data.count === 0 || data.results.length === 0) { | ||
| throw new NotFound({ prettyMessage: 'repository not found' }) |
There was a problem hiding this comment.
Wouldn't "repository not found" be triggered by a 404? Couldn't this case instead happen for a repository that does exist but that has not yet published any images?
There was a problem hiding this comment.
Good catch — you’re right.
A 404 from the Hub API is already mapped to repository or tag not found. Hitting count === 0 / empty results on a 200 is a different case: the repository is there, it just doesn’t have any tags published yet.
I’ve updated the message to no tags found and adjusted the unit tests to match. Thanks for spotting that.
|
Thanks for the review, @PyvesB. Pushed a small fix for the empty-results path: that case now surfaces as |
Show when the newest (or a specific) Docker Hub image tag was last updated, using the public registry tags API ordered by last_updated.
Empty Hub results mean a repository with no published tags, not a missing repository. 404s already map to repository or tag not found.
70467c1 to
2df0136
Compare
PyvesB
left a comment
There was a problem hiding this comment.
Thanks for another good contribution!
Description
Adds a Docker Hub last updated badge that shows when the newest image tag (or a specific tag) was last pushed.
/docker/last-updated/:user/:repo/docker/last-updated/:user/:repo/:tagordering=last_updated(same family as existing Docker badges)renderDateBadge(activity color scale by age)Examples:
https://img.shields.io/docker/last-updated/_/alpinehttps://img.shields.io/docker/last-updated/_/alpine/latesthttps://img.shields.io/docker/last-updated/datadog/dogstatsdLive API verification
Tests
npm run test:core -- --grep DockerLastUpdated→ 4 passingnpm run test:services -- --only=DockerLastUpdated→ 6 passingReferences
AI note
Drafted with AI assistance; API responses, service pattern, and tests were verified locally before submitting.