MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
770 stars 438 forks source link

[Proposal] [Docker images] add OCI label org.opencontainers.image.source #436

Closed OuesFa closed 1 year ago

OuesFa commented 2 years ago

I'm using Renovate to update dependencies. Renovate supports docker label org.opencontainers.image.source to point to source and add the release notes in the created PR. It doesn't find the source url in the mariadb images when it opens a PR to update our dockerfiles automatically. Is it possible to add the following OCI label org.opencontainers.image.source in the docker image of mariadb to indicate the source repo URL? Thanks!

grooverdan commented 2 years ago

Technically OCI Image Spec Annotations.

I'm happy to add them, they seem to be just LABELs. Can you help clarify what Renovate is expecting here? How are they going to be different for each version (10.3 -> 10.10) released?

In the CI of these Images I'm using these annotations.

OuesFa commented 2 years ago

Hi! Here's what have been done on another open source project.

org.opencontainers.image.source="https://github.com/elastic/cloud-on-k8s/"

I guess in that case it is sufficient because of the tags in the repo.

Since there is no tags in this repo I'm not sure actually, we could try what you already done for the CI.

grooverdan commented 2 years ago

If Renovate is going to use the tags, do I need to include all in this repo on release. For an insight into Docker Library releases, https://github.com/docker-library/official-images/pull/12470 is the PR that did the update. Would you be wanting all the Tags for the Git-Commit?

Polling the registry based on org.opencontainers.image.base.name would seem to be the more direct approach and comparing the digest and semantic/docker versioning there and locally. Maybe I'm missing something.

ref docs: https://docs.renovatebot.com/modules/datasource/#docker-datasource

Is the Renovate config from https://github.com/MariaDB/mariadb-docker/issues/415#issuecomment-1051995586 sufficient? I'm not sure what a OCI label will assist with beyond this config.

Note fixes to versioning for Renovate where done in #415

OuesFa commented 2 years ago

I'm not sure either about the Renovate internals, I'm going to ask on their repo directly.

tobiasbaehr commented 2 years ago

I believe it is not usefully to use the labels in such images, because renovate has then no releases which can be used. https://github.com/MariaDB/server has also no releases. Can not be used as source. (no benefit)

So I would say just use the normal docker images update based on the docker tags and

perhaps the commitBody could contains a link to https://mariadb.com/kb/en/mariadb-{{{replace '.' '' newVersion}}}-release-notes/ 10.9.1 -> https://mariadb.com/kb/en/mariadb-1091-release-notes/ when you really needs to know whats was changed.

The only benefit would be, renovate could link to the projects in the PR.

https://docs.renovatebot.com/configuration-options/#commitbody https://docs.renovatebot.com/templates/

grooverdan commented 2 years ago

Thanks @tobiasbaehr. So my understanding is the docs on https://docs.renovatebot.com/modules/datasource/#docker-datasource should refer to it behaving like github-releases or gitlab-releases after obtaining the url.

So I would say just use the normal docker images update based on the docker tags

This sound good, especially as the tags where fixed for exactly this case in #415.

Commits that touch the file https://github.com/docker-library/official-images/blob/master/library/mariadb is also the second most reliable indication of a release. After that file is changed the docker-library build process starts and pushes to the DockerHub repository.

perhaps the commitBody could contains a link..

I'm not sure what commit this is referring to, but if there's a convention that would be useful let me know.

There's also a https://downloads.mariadb.org/rest-api/mariadb/{{newVersion}} API.

I'll endeavor to populate the images with the OCI annotations, even if the use by Renovatebot isn't there yet.

tobiasbaehr commented 2 years ago

commitBody was for @OuesFa but better is then to use https://docs.renovatebot.com/configuration-options/#prbodynotes.

And yes you can add the labels, but renovate would then not magically show the release note of mariadb in a PR/MR. This is what I try to explain. 😄

OuesFa commented 2 years ago

Thanks @tobiasbaehr for the suggestion, I just tested the prbodynotes config and it works like a charm, I have just one issue, when I try to replace the '.' character by a '', it seems to interpret the dot character as a wildcard to match every character and I end up with a malformed link like this one https://mariadb.com/kb/en/mariadb--release-notes/

I tried to escape the dot character like this https://mariadb.com/kb/en/mariadb-{{{replace '\.' '' newVersion}}}-release-notes/ but it doesn't work, I have the same result. Note that it works fine for other characters, example https://mariadb.com/kb/en/mariadb-{{{replace '1' 'dummy' newVersion}}}-release-notes/ => https://mariadb.com/kb/en/mariadb-dummy0.9.dummy-release-notes/ in case the new version is 10.9.1

Do you have an idea how to escape the dot character properly?

Besides, do you know what would need to be added/updated on the mariadb-docker repo in order for Renovate to be able to get the proper release notes in case we add the appropriate docker image labels?

OuesFa commented 2 years ago

Alright this worked for the syntax issue {{{replace '\\.' '' newVersion}}}

grooverdan commented 1 year ago

labels added.