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

[feat] Add labels to docker image linking to git hash #257

Closed
LordMike opened this issue Jan 16, 2021 · 10 comments
Closed

[feat] Add labels to docker image linking to git hash #257

LordMike opened this issue Jan 16, 2021 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@LordMike
Copy link
Contributor

LordMike commented Jan 16, 2021

Is your feature request related to a problem? Please describe.
When downloading a docker image, it could be useful to know exactly which commit this image was from. This goes for both zwave-js and zwavejs2mqtt.

Describe the solution you'd like
Add a label on builds, with the git hash of the two projects.

I'm fairly certain the change has to happen around here, but I'm not sure what to do.

Describe alternatives you've considered
N/A

Additional context
Pro-tip: Use well-defined labels, like these. I'd add org.label-schema.vcs-ref, org.label-schema.build-date and org.label-schema.schema-version.

@LordMike LordMike added the enhancement New feature or request label Jan 16, 2021
@robertsLando
Copy link
Member

@LordMike
Copy link
Contributor Author

Exactly. :)

Damn. That's a large set of labels for the Hassio setup :O

@robertsLando
Copy link
Member

robertsLando commented Jan 18, 2021

I think this could be enought:

# Labels.
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.build-date=$BUILD_DATE
LABEL org.label-schema.name="zwave-js/zwavejs2mqtt"
LABEL org.label-schema.description="Zwave to Mqtt Gateway and control panel"
LABEL org.label-schema.url="https://zwave-js.github.io/zwavejs2mqtt/#/"
LABEL org.label-schema.vcs-url="https://github.com/zwave-js/zwavejs2mqtt"
LABEL org.label-schema.vcs-ref=$VCS_REF
LABEL org.label-schema.vendor="zwave-js"
LABEL org.label-schema.version=$BUILD_VERSION
LABEL org.label-schema.docker.cmd="docker run --rm -it -p 8091:8091 --device=/dev/ttyACM0 -v $(pwd)/store:/usr/src/app/store zwavejs/zwavejs2mqtt:latest"

Build args:

--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` .

@robertsLando
Copy link
Member

Seems label-schema is deprecated in favour of https://github.com/opencontainers/image-spec/blob/master/annotations.md

@LordMike
Copy link
Contributor Author

Oh I see - they did deprecate it .. They could've put a larger warning on the page :|

The list of labels looks good. Vcs-ref is there, along with build-date.

Would it be possible to get the git hash, of zwave-js?

@robertsLando
Copy link
Member

@LordMike See the new labels:

https://github.com/zwave-js/zwavejs2mqtt/runs/1726326203#step:7:38

@LordMike
Copy link
Contributor Author

LordMike commented Jan 19, 2021

Neat. Looks cool - will definitely make it easier to know if I'm definitely running some hash.

I'm guessing that getting the hash of zwavejs is tricky?

It's my impression that the dev builds include latest/master builds of zwave-js, so in order to verify if a bugfix applies (and doesn't work), it'd be beneficial to know this hash as well.. Perhaps it could be shown in the UI / logs instead, if the labels pose an issue.

In any case.. This is a great addition 👍

Edit: I also just noticed that docker builds are for pr's as well.. Woop woop :)

@robertsLando
Copy link
Member

robertsLando commented Jan 19, 2021

I'm guessing that getting the hash of zwavejs is tricky?

It's shown on the UI :)

@LordMike
Copy link
Contributor Author

I can't find it :O

But neat.

@robertsLando
Copy link
Member

Oooh nope I had to add it but I forgot, the one shown is the z2m version. Could you add an issue as a reminder?

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

Successfully merging a pull request may close this issue.

2 participants