GoogleContainerTools / jib-extensions

Apache License 2.0
117 stars 35 forks source link

Is it possible to set jib.pluginExtensions.pluginExtension.implementation via gradle system prop? #150

Open sharkymcdongles opened 1 year ago

sharkymcdongles commented 1 year ago

I tried adding the following in build.gradle for the com.google.cloud.tools:jib-native-image-extension-gradle:

buildscript {
  dependencies {
    classpath('com.google.cloud.tools:jib-native-image-extension-gradle:0.1.0')
  }
}

I then tried to set the extension at runtime via a system prop e.g.: -Djib.pluginExtensions.pluginExtension.implementation=com.google.cloud.tools.jib.gradle.extension.nativeimage.JibNativeImageExtension without success.

Goal is to be able to set the native image plugin at runtime instead of in build.gradle so I can toggle it off or on in the pipeline easily for each service.

I would like to be able to set the following via -D properties:

jib {
  pluginExtensions {
    pluginExtension {
        implementation = 'com.google.cloud.tools.jib.gradle.extension.nativeimage.JibNativeImageExtension'
        properties = [
            imageName: "${CI_PROJECT_NAME}"
        ]
    }
  }
}

I tried every option I could and also searched the docs extensively without success.

mpeddada1 commented 1 year ago

@sharkymcdongles Perhaps this could be achieved with a project property as shown here: https://github.com/GoogleContainerTools/jib/issues/612#issuecomment-405320538