Closed johannespostler closed 1 month ago
Not sure if you will like it, but what if you use a property (for example, passing -Pprod
)?
if (project.hasProperty('prod')) {
jib.to.image = 'eu.gcr.io/project/production-image'
} else {
jib.to.image = 'eu.gcr.io/project/testing-image'
}
Hi Chanseok, We tried this and combined it with settings this property in two distinct tasks (finalizedBy jib). However, it didn't work as Gradle expected to have the property during the configuration phase already. We hence came up with the following solution:
task jibProduction {
doFirst {
jib.to.image = "eu.gcr.io/project/image-prod"
}
finalizedBy ':subproject:jib'
}
task jibTesting {
doFirst {
jib.to.image = "eu.gcr.io/project/image-testing"
}
finalizedBy ':subproject:jib'
}
This works fine for us. Thanks for the help! I'm not sure as to whether to close the issue or not, as several gradle jib-tasks might still be useful im some cases?
we can create new BuildDockerTask
, BuildImageTask
and BuildTarTask
tasks.
However, integrations with other gradle plugins which assume the use of the default jib
task will break though
Description of the issue: Sometimes it is required to have several configurations in gradle depending on the lifecycle stage of the code deployed. Specifically I'd like to have two jib configurations that tag images differently and push them to different behavious.
Expected behavior:
I want to have a gradle configuration like so:
Steps to reproduce:
Use above gradle config closure.
Environment: Gradle 4.10
Kotlin DSL: 1.0-rc-3 Kotlin: 1.2.60 Groovy: 2.4.15 Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018 JVM: 1.8.0_181 (Oracle Corporation 25.181-b13) OS: Linux 5.1.12-300.fc30.x86_64 amd64
jib-gradle-plugin
Configuration: see aboveLog output:
Cannot create a proxy class for abstract class 'JibTask'.
Additional Information: I also tried to create a JibExtension and use this to configure a jibTask.
Any other alternative to achieve a similar result is also fine. For example, the same problem can be tackled with the appEngine gradle plugin using configuration files: