GoogleContainerTools / jib

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

Image labels appear in the extra directory layer manifest #4315

Open sgashchenko-tempo opened 2 months ago

sgashchenko-tempo commented 2 months 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 2 months ago

It looks like this behavior is consistent with docker build.

ldetmer commented 1 week ago

@sgashchenko-tempo can you please confirm if the issue still exists?