-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Just like there was an issue to make the jib.to.tags and jib.to.auth to be lazyly evaluated I would need to have the container.labels do the same. Even the reason is the same. I use com.gorylenko.gradle-git-properties Gradle plugin and would like to reuse its properties to add labels to my images. Something like that:
jib {
container {
labels = [
'org.label-schema.vcs-url': project.ext.gitProps['git.remote.origin.url'],
'org.label-schema.vcs-branch': project.ext.gitProps['git.branch'],
'org.label-schema.vcs-ref': project.ext.gitProps['git.commit.id.abbrev']
]
}
}
In our case I would make that configuration global and add this snipped to our custom gradle wrapper init script.
I did try something like this:
jib
container {
labels = [
...
'org.label-schema.vcs-ref': "${-> project.ext.gitProps['git.commit.id.abbrev']}"
]
}
}
But this errored out with this message:
> class org.codehaus.groovy.runtime.GStringImpl cannot be cast to class java.lang.String (org.codehaus.groovy.runtime.GStringImpl is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @47c62251; java.lang.String is in module java.base of loader 'bootstrap')