Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add OCI labels, rework tagging #361

Merged
merged 2 commits into from
Feb 14, 2024
Merged

add OCI labels, rework tagging #361

merged 2 commits into from
Feb 14, 2024

Conversation

pxlfrk
Copy link
Contributor

@pxlfrk pxlfrk commented Feb 13, 2024

i'm using Renovate to automatically update dependencies. Renovate (and similar tools as well) support the docker label org.opencontainers.image.source, also known as OCI labels to point to sources and add the release notes in the created PRs --> see for example a PR for tandoor:

image

I noticed, that this docker-volume-backup currently doesn't leverage these labels and implemented them.
When possible i tried to stick to variables instead of hardcoding informations to keep the package dynamically, in case someone forks and wants to distribute it by himself.

Furthermore i kind of reworked the tagging code and replaced it with the popolur github-action metadata-action.

I stuck with the current logic and implemented a rule, that e.g. the tag v2.15.4-alpha.2 doens't get the latest-tag.

# tag releases as latest, except prerelease tags like `v2.0.0-alpha.x`
type=raw,value=latest,enable=${{ !contains(github.ref, 'alpha') }}

See the full documentation for the semver-mapping.

I look forward to improvements, reviews and tips!

@m90
Copy link
Member

m90 commented Feb 13, 2024

Thanks for opening this PR. I am happy to add the labels, but I would prefer to stick with the current state of the tagging code. It took me ages to get this going and I just could not understand how the metadata action is expecting me to configure it, which is why the custom script is there. As I'll have to keep maintaining this I'd like to keep what I understand. Or does your patch fix anything that is broken in this regard?

As far as I understand we can add the labels without changing the tagging logic, right?

@pxlfrk
Copy link
Contributor Author

pxlfrk commented Feb 13, 2024

Thanks! No, my patch doesn't fix somethink broken, after looking into this and reading the manuals i just found this solution some kind of easier and more streamlined. Since i haven't run the workflow, i couldn't test this fix yet and i don't know how to do this without setting up the workflow in my fork as well.

Until i figured this out and tested this, i'll change the PR, so that the action only adds the labels, and the tag will be provided by your current workflow-step.

@m90 m90 merged commit 37f9bd9 into offen:main Feb 14, 2024
2 checks passed
@m90
Copy link
Member

m90 commented Feb 14, 2024

Thanks!

@m90
Copy link
Member

m90 commented Feb 15, 2024

I just released an image using this for the first time and when inspecting the image, some values are double quoted

            "Labels": {
                "org.opencontainers.image.created": "2024-02-15 UTC 11:05:49",
                "org.opencontainers.image.description": "\"Backup Docker volumes locally or to any S3, WebDAV, Azure Blob Storage, Dropbox or SSH compatible storage\"",
                "org.opencontainers.image.documentation": "\"https://offen.github.io/docker-volume-backup/\"",
                "org.opencontainers.image.licenses": "\"MPL-2.0\"",
                "org.opencontainers.image.revision": "a01fc3df3f7030569661e324687d6ae97bc84d1d",
                "org.opencontainers.image.source": "https://github.com/offen/docker-volume-backup",
                "org.opencontainers.image.title": "docker-volume-backup",
                "org.opencontainers.image.url": "\"https://offen.github.io/docker-volume-backup/\"",
                "org.opencontainers.image.vendor": "offen",
                "org.opencontainers.image.version": "v2.37.3"
            }

Is this expected or should we do something about it?

@m90
Copy link
Member

m90 commented Feb 15, 2024

Seems the docs are using unqoted literal strings https://github.com/docker/metadata-action?tab=readme-ov-file#inputs

@pxlfrk
Copy link
Contributor Author

pxlfrk commented Feb 15, 2024

You're right - the correct syntax would be without quotes: org.opencontainers.image.url=https://offen.github.io/docker-volume-backup.

Should i send a commit to fix this?

@m90
Copy link
Member

m90 commented Feb 15, 2024

Already did that, thanks #365

@pxlfrk
Copy link
Contributor Author

pxlfrk commented Feb 16, 2024

It works, thanks! Now i cann see the changelog directly in the PRs :)
Just wanted to let you (& possible fellow readers of this PR) know ...

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants