GoogleContainerTools / jib

🏗 Build container images for your Java applications.
Apache License 2.0
13.62k stars 1.43k forks source link

Image labels appear in the extra directory layer manifest #4315

Open sgashchenko-tempo opened 2 days ago

sgashchenko-tempo commented 2 days ago

Environment:

Description of the issue: Container labels (jib.container.labels), in addition to the image descriptor, appear in the manifest of the extra directory layer. When using non-constant values, this causes the layer digest to change.

image.json layer.json

Expected behavior: Labels are listed only in the image descriptor.

Steps to reproduce:

  1. Build https://github.com/sgashchenko-tempo/jib-extra-dir-labels
  2. Check the extra directory layer manifest

jib-gradle-plugin Configuration:

jib {
  from {
    image = "eclipse-temurin:17-jre-alpine"
  }
  to {
    image = "jib-extra-dir-labels:latest"
  }
  extraDirectories {
    paths {
      path {
        setFrom(layout.projectDirectory.dir("extra-dir"))
      }
    }
  }
  container {
    labels.put("some-label", "some-value")
  }
}
sgashchenko-tempo commented 1 day ago

It looks like this behavior is consistent with docker build.