drone-plugins / drone-docker

Drone plugin for publishing Docker images
http://plugins.drone.io/drone-plugins/drone-docker
Apache License 2.0
317 stars 318 forks source link

Add DRONE_BUILD_NUMBER to container labels #192

Open johnrengelman opened 6 years ago

johnrengelman commented 6 years ago

The Label Schema properties encode vcs-ref and vcs-url which gives you the drone build and commit that created the container, but it lacks the build number.

Label Schema doesn't have a build-number property in its spec, so I'm not sure if we should add this to the default list that is already supported or if we should add a separate name space such as io.drone.build-number.

This could be done in addition to the user defined labels being worked on here: https://github.com/drone-plugins/drone-docker/pull/180

bradrydzewski commented 6 years ago

@johnrengelman sounds good to me.

@tboerger is there an official / standard label for build number? If not, I'm good with io.drone.build-number unless you have suggestions for a different naming schema

johnrengelman commented 6 years ago

Hmm according to their website, the Label Schema project is deprecated (https://github.com/label-schema/label-schema.org) in favor of the OCI Image Spec (https://github.com/opencontainers/image-spec/blob/v1.0.0/annotations.md#pre-defined-annotation-keys)

tboerger commented 6 years ago

So we should switch to the new schema?

johnrengelman commented 6 years ago

I'm not sure. I'm not familiar with how these labels are used out in the wild. Maybe just leave it alone until someone asks for the new ones? and then we can add both? Anyway, it's beyond the scope of this particular ticket. Neither Label Schema nor OCI Image Spec define a label/annotation for build-number. So, I think we should add it under a io.drone namespace. And additionally, maybe we should populate a number of standard values into io.drone:

tboerger commented 6 years ago

Repo, url and commit are already part of the specifications. Only the build number is missing

johnrengelman commented 6 years ago

@tboerger yup. Agreed. I'm good with just implementing the build number if we want. Was just trying to flush out some future proofing. If we can agree to something, I'd be happy to submit a PR.

So the proposal is:

Agree?

tboerger commented 6 years ago

Agree!

johnrengelman commented 6 years ago

PR - https://github.com/drone-plugins/drone-docker/pull/204