jib: Jib may be unable to send client certificate

UPDATE(@chanseokoh): this issue was re-purposed to track the potential problem that Jib may be unable to send client certificate in secure TLS connection: https://github.com/GoogleContainerTools/jib/issues/2226#issuecomment-573116497

Original comment follows below.


Environment:

  • Jib version: 1.8.0
  • Build tool: Maven 3.6.2
  • OS: Windows 10

Description of the issue: When the build fails, the actual error message is null. This causes an NPE when the exception is wrapped thus hiding the original exception.

Expected behavior: The actual error is shown

Steps to reproduce:

mvn clean package jib:build

Additional Information:

The target docker registry is spawned from minishift (on the same host). Using a different docker registry works fine.

https://github.com/GoogleContainerTools/jib/blob/9905c13be36bf43a536eb3ad7de54c97c130ebb7/jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/JibBuildRunner.java#L275

Log
[INFO] --- jib-maven-plugin:1.8.0:build (default-cli) @ dummy-service ---
[WARNING] Setting image creation time to current time; your image may not be reproducible.
[INFO]
[INFO] Containerizing application to 192.168.1.2:2376/dummy-service:1.0.0-SNAPSHOT...
[WARNING] Base image 'adoptopenjdk/openjdk11:alpine-jre' does not use a specific image digest - build may not be reproducible
[WARNING] The credential helper (docker-credential-desktop) has nothing for server URL: 192.168.1.2:2376

Got output:

credentials not found in native keychain

[WARNING] Cannot verify server at https://192.168.1.2:2376/v2/. Attempting again with no TLS verification.
[WARNING] Failed to connect to https://192.168.1.2:2376/v2/ over HTTPS. Attempting again with HTTP.
[ERROR] I/O error for image [192.168.1.2:2376/dummy-service]:
[ERROR]     null
[WARNING] Cannot verify server at https://registry-1.docker.io/v2/adoptopenjdk/openjdk11/manifests/alpine-jre. Attempting again with no TLS verification.
[INFO] Executing tasks:
[INFO] [========                      ] 27,5% complete
[INFO] > pulling base image manifest
[INFO] > building dependencies layer
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  46.389 s
[INFO] Finished at: 2020-01-10T15:00:00+00:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.8.0:build (default-cli) on project dummy-service: Execution default-cli of goal co
m.google.cloud.tools:jib-maven-plugin:1.8.0:build failed: expected a non-null reference -> [Help 1]
Debug-Log
[DEBUG] TIMING        Pulling base image manifest
[DEBUG] TIMING        Preparing application layer builders
[DEBUG] TIMED Preparing application layer builders : 0.976 ms
[DEBUG] TIMING        Building dependencies layer
[DEBUG] TIMING        Building resources layer
[DEBUG] TIMING        Building snapshot dependencies layer
[DEBUG] TIMING        Building classes layer
[DEBUG] TIMED Building classes layer : 227.477 ms
[DEBUG] TIMED Building snapshot dependencies layer : 230.405 ms
[DEBUG] Building resources layer built sha256:e1197e6b2e8ff0d348266e2cd02d484818ca148f868b20eb411b7b7dff330459
[DEBUG] TIMED Building resources layer : 303.636 ms
[WARNING] The credential helper (docker-credential-desktop) has nothing for server URL: 192.168.1.2:2376

Got output:

credentials not found in native keychain

[DEBUG] No credentials could be retrieved for registry 192.168.1.2:2376
[DEBUG] TIMED Retrieving registry credentials for 192.168.1.2:2376 : 366.123 ms
[DEBUG] TIMING        Authenticating push to 192.168.1.2:2376
[WARNING] Cannot verify server at https://192.168.1.2:2376/v2/. Attempting again with no TLS verification.
[WARNING] Failed to connect to https://192.168.1.2:2376/v2/ over HTTPS. Attempting again with HTTP.
[ERROR] I/O error for image [192.168.1.2:2376/dummy-service]:
[ERROR]     null
[DEBUG] TIMED Authenticating push to 192.168.1.2:2376 : 135.71 ms
[DEBUG] TIMED Building and pushing image : 523.297 ms
[WARNING] Cannot verify server at https://registry-1.docker.io/v2/adoptopenjdk/openjdk11/manifests/alpine-jre. Attempting again with no TLS verification.
[INFO] Executing tasks:
[INFO] [========                      ] 27,5% complete
[INFO] > pulling base image manifest
[INFO] > building dependencies layer
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  47.025 s
[INFO] Finished at: 2020-01-10T15:00:00+00:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.8.0:build (default-cli) on project dummy-service: Execution default-cli of goal co
m.google.cloud.tools:jib-maven-plugin:1.8.0:build failed: expected a non-null reference -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.8.0:build (default-cli) on project du
mmy-service: Execution default-cli of goal com.google.cloud.tools:jib-maven-plugin:1.8.0:build failed: expected a non-null reference
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal com.google.cloud.tools:jib-maven-plugin:1.8.0:build failed: expected a non-null reference
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: com.google.common.base.VerifyException: expected a non-null reference
    at com.google.common.base.Verify.verify (Verify.java:124)
    at com.google.common.base.Verify.verifyNotNull (Verify.java:500)
    at com.google.common.base.Verify.verifyNotNull (Verify.java:477)
    at com.google.cloud.tools.jib.plugins.common.JibBuildRunner.runBuild (JibBuildRunner.java:275)
    at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:99)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

PS: Do you have any hint what the original error could have been?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

I didn’t manage to get it running. I have no more time to try this (I’m not even sure this is related to Java at all). Thanks for your help.

Please fix the NPE in the error message anyway.

Ah, I don’t know much about this stuff, but reading https://community.letsencrypt.org/t/curl-35-errorssl-routinessslv3-alert-bad-certificate/85239/5, the client has to present a certificate too? (I’m just talking gibberish here.)

I think there’s a problem.

curl: (35) error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate