drone-docker icon indicating copy to clipboard operation
drone-docker copied to clipboard

Add DRONE_BUILD_NUMBER to container labels

Open johnrengelman opened this issue 7 years ago • 8 comments

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

johnrengelman avatar Sep 11 '18 01:09 johnrengelman

@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

bradrydzewski avatar Sep 11 '18 02:09 bradrydzewski

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)

johnrengelman avatar Sep 11 '18 03:09 johnrengelman

So we should switch to the new schema?

tboerger avatar Sep 11 '18 06:09 tboerger

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:

  • io.drone.build-number
  • io.drone.build-repo
  • io.drone.build-commit
  • io.drone.build-url Thoughts?

johnrengelman avatar Sep 11 '18 13:09 johnrengelman

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

tboerger avatar Sep 11 '18 18:09 tboerger

@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:

  • Add io.drone.build-number

Agree?

johnrengelman avatar Oct 04 '18 13:10 johnrengelman

Agree!

tboerger avatar Oct 04 '18 13:10 tboerger

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

johnrengelman avatar Oct 04 '18 18:10 johnrengelman