renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.25k stars 2.25k forks source link

Not getting latest tag from docker api for resolving the sourceUrl from OCI label #10442

Closed jeskosda closed 3 years ago

jeskosda commented 3 years ago

How are you running Renovate?

Describe the bug

I changed the OCI label org.opencontainers.image.source of the images which are processed by renovate. My goal was to show the release notes of the github repository (which is now referenced in the image label) in the Renovate PR for docker images. But for some reasons, the sourceUrl is still some random old tag with a old version of org.opencontainers.image.source. My assumption is, that the tags are not returned in sorted order, hence the latestTag const latestTag = tags.includes('latest') ? 'latest' : tags[tags.length - 1]; in https://github.com/renovatebot/renovate/blob/main/lib/datasource/docker/index.ts#L231 returns not the latest tag in the registry. (We do not use the 'latest' tags)

Relevant debug logs

Click me to see logs ``` DEBUG: getLabels(https://nexus-registry, some-image, some-random-old-tag) DEBUG: found labels in manifest { "labels": { "org.opencontainers.image.title": " **** ", "org.opencontainers.image.source": "https://github.com/old-source", "org.opencontainers.image.url": "***", "org.opencontainers.image.licenses": "***", "org.opencontainers.image.revision": "***", "org.opencontainers.image.version": "***", "org.opencontainers.image.description": "***" } } ```

Have you created a minimal reproduction repository?

Please read the minimal reproductions documentation to learn how to make a good minimal reproduction repository.

Additional context

...

HonkingGoose commented 3 years ago

We don't support reading OCI Docker/Container manifests (see issue #10046). It might be that's causing the problem you see right now?

jeskosda commented 3 years ago

Thanks for the fast response! I updated the debug logs part. At least the log is showing that the old manifest could be read, but with the old "org.opencontainers.image.source": "https://github.com/old-source"

Edit: It's docker image using the oci specifcation labels.

rarkins commented 3 years ago

does this describe the current problem?

jeskosda commented 3 years ago

Yes, this is probably my current problem.

Each tag can have a different source URL

Newer tags from < X.X.X have a new source URL.

Renovate checks for a latest tag and if one doesn't exist then takes whatever was the last tag in the fetched list?

Yes, and the last tag in the fetched list is one of the older tags > X.X.X

Your registry is not returning the most recent tags last?

Yes. Using Nexus Repository OSS

viceice commented 3 years ago

@rarkins Idea, if no latest tag, sort tags by docker versioning and use greatest stable version for labels?

https://github.com/renovatebot/renovate/blob/cd078e73bde134eb6359c95684e3911c6329e348/lib/datasource/docker/index.ts#L231-L235

I can maybe send a pr today afternoon.

renovate-release commented 3 years ago

:tada: This issue has been resolved in version 25.43.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jeskosda commented 3 years ago

@rarkins When do the new releases usually affect the Renovate Bot in Github? Is the update overnight or directly after release? Would like to test the bug fix.

rarkins commented 3 years ago

@jeskosda it's actually a manual approval process for it to go live in the app and never automatic, because we like to observe for elevated errors or abnormalities to be able to roll back if necessary. In this case it went live about 1-2 hours ago so you could click the rebase/retry checkbox on any open PRs you have to make sure the app runs again immediately

jeskosda commented 3 years ago

Awesome! Thanks for the quick fix and great work! Very responsive!