Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run program "docker-credential-ecr-login.cmd" #2527

Closed
ahoehma opened this issue Jun 12, 2020 · 9 comments · Fixed by #2529
Closed

Cannot run program "docker-credential-ecr-login.cmd" #2527

ahoehma opened this issue Jun 12, 2020 · 9 comments · Fixed by #2529
Assignees
Milestone

Comments

@ahoehma
Copy link

ahoehma commented Jun 12, 2020

Environment: git-bash

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Java version: 1.8.0_252, vendor: Azul Systems, Inc., runtime: D:\Dev\Java\jdk8x64\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

  • Jib version: 2.4.0
  • Build tool: maven 3.6.3
  • OS: windows

Description of the issue:

I installed "docker-credential-ecr-login" ... and I can use it :)

MINGW64 /d/Dev/git/coc/spice-configuration-cluster (develop)
$ docker-credential-ecr-login list
{"https://XXXXXXXXX.dkr.ecr.eu-west-1.amazonaws.com":"AWS"}

MINGW64 /d/Dev/git/coc/spice-configuration-cluster (develop)
$ docker-credential-ecr-login version
0.6.3

MINGW64 /d/Dev/git/coc/spice-configuration-cluster (develop)
$ which docker-credential-ecr-login
/c/Users/hoehmann/go/bin/docker-credential-ecr-login

But inside the jib-run it doesn't work.
It seems that jib is trying to execute docker-credential-ecr-login.cmd
instead of docker-credential-ecr-login.exe or docker-credential-ecr-login

Expected behavior:

docker-credential-ecr-login should work under windows-git-bash as well

Steps to reproduce:

  1. installed docker-credential-ecr-login with "go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login"
  2. add jib-maven-plugin
  3. run maven

jib-maven-plugin Configuration:

<configuration>
            <to>
              <image>${aws.ecr.url}/${finalName}:latest</image>
              <credHelper>ecr-login</credHelper>
            </to>
            <container>
              <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
              <ports>
                <port>8080</port>
              </ports>
            </container>
          </configuration>

Log output:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.4.0:build (default-cli) on project rest-service-sce: java.io.IOException: Cannot run program "docker-credential-ecr-login.cmd": CreateProcess error=2, Das System kann die angegebene Datei nicht finden -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.4.0:build (default-cli) on project rest-service-sce: java.io.IOException: Cannot run program "docker-credential-ecr-login.cmd": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
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.MojoExecutionException: java.io.IOException: Cannot run program "docker-credential-ecr-login.cmd": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:162)
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:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
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.cloud.tools.jib.registry.credentials.CredentialRetrievalException: java.io.IOException: Cannot run program "docker-credential-ecr-login.cmd": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at com.google.cloud.tools.jib.frontend.CredentialRetrieverFactory.lambda$dockerCredentialHelper$1 (CredentialRetrieverFactory.java:150)
at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.retrieve (RegistryCredentialRetriever.java:47)
at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.getTargetImageCredential (RegistryCredentialRetriever.java:40)
at com.google.cloud.tools.jib.builder.steps.AuthenticatePushStep.call (AuthenticatePushStep.java:57)
at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$authenticateBearerPush$3 (StepsRunner.java:236)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: java.io.IOException: Cannot run program "docker-credential-ecr-login.cmd": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at java.lang.ProcessBuilder.start (ProcessBuilder.java:1048)
at com.google.cloud.tools.jib.registry.credentials.DockerCredentialHelper.retrieve (DockerCredentialHelper.java:132)
at com.google.cloud.tools.jib.registry.credentials.DockerCredentialHelper.retrieve (DockerCredentialHelper.java:117)
at com.google.cloud.tools.jib.frontend.CredentialRetrieverFactory.retrieveFromDockerCredentialHelper (CredentialRetrieverFactory.java:296)
at com.google.cloud.tools.jib.frontend.CredentialRetrieverFactory.lambda$dockerCredentialHelper$1 (CredentialRetrieverFactory.java:141)
at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.retrieve (RegistryCredentialRetriever.java:47)
at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.getTargetImageCredential (RegistryCredentialRetriever.java:40)
at com.google.cloud.tools.jib.builder.steps.AuthenticatePushStep.call (AuthenticatePushStep.java:57)
at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$authenticateBearerPush$3 (StepsRunner.java:236)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: java.io.IOException: CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at java.lang.ProcessImpl.create (Native Method)
at java.lang.ProcessImpl. (ProcessImpl.java:444)
at java.lang.ProcessImpl.start (ProcessImpl.java:139)
at java.lang.ProcessBuilder.start (ProcessBuilder.java:1029)
at com.google.cloud.tools.jib.registry.credentials.DockerCredentialHelper.retrieve (DockerCredentialHelper.java:132)
at com.google.cloud.tools.jib.registry.credentials.DockerCredentialHelper.retrieve (DockerCredentialHelper.java:117)
at com.google.cloud.tools.jib.frontend.CredentialRetrieverFactory.retrieveFromDockerCredentialHelper (CredentialRetrieverFactory.java:296)
at com.google.cloud.tools.jib.frontend.CredentialRetrieverFactory.lambda$dockerCredentialHelper$1 (CredentialRetrieverFactory.java:141)
at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.retrieve (RegistryCredentialRetriever.java:47)
at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.getTargetImageCredential (RegistryCredentialRetriever.java:40)
at com.google.cloud.tools.jib.builder.steps.AuthenticatePushStep.call (AuthenticatePushStep.java:57)
at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$authenticateBearerPush$3 (StepsRunner.java:236)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)

Additional Information:
mvn -DskipTests -Denforcer.skip -nsu jib:build -X

@loosebazooka
Copy link
Member

probably related to this PR: #2403

@loosebazooka
Copy link
Member

@ahoehma was this working before, and stopped working when you upgraded to 2.4.0?

@chanseokoh chanseokoh modified the milestones: v2.4.0, v2.5.0 Jun 12, 2020
@chanseokoh chanseokoh self-assigned this Jun 12, 2020
@chanseokoh
Copy link
Member

@ahoehma was this working before, and stopped working when you upgraded to 2.4.0?

I am also curious. For now, I think you can set

    <credHelper>ecr-login.exe</credHelper>

@ahoehma
Copy link
Author

ahoehma commented Jun 18, 2020

@chanseokoh ... was never working before :)

@ahoehma
Copy link
Author

ahoehma commented Jun 19, 2020

@chanseokoh .... today I tried your suggestion 'ecr-login.exe' ... and this works :) with 2.4.0 too.

@Gsealy
Copy link

Gsealy commented Jun 19, 2020

@chanseokoh same issue, use 2.3.0 build success, 2.4.0 occur this error

Environment:
Windows Terminal

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: C:\apache-maven\bin\..
Java version: 11, vendor: Oracle Corporation, runtime: C:\Java\jdk-11
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

docker for windows version:

docker desktop: 2.3.0(45519)
Docker version 19.03.8, build afacb8b
Credntial Helper: 0.6.3

jib-maven-plugin Configuration:

     <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>2.4.0</version>
        <configuration>
          <from>
            <image>hub.gsealy.cn/base-image/jdk:11.0</image>
          </from>
          <to>
            <image>spring-boot-jib</image>
          </to>
          <allowInsecureRegistries>true</allowInsecureRegistries>
          <container>
            <ports>
              <port>9999</port>
            </ports>
          </container>
        </configuration>
      </plugin>

description:
we are use harbor for docker registry at inner network, and use Let's encrypt cert for ssl. 2.3.0 also print warning but build succeed.
I don't find docker-credential-desktop.cmd in system, just have docker-credential-desktop.exe

... omit ...
[DEBUG] trying docker-credential-desktop for hub.gsealy.cn
[WARNING] Cannot run program "docker-credential-desktop.cmd": CreateProcess error=2, cannot find the file.
[WARNING]   Caused by: CreateProcess error=2, cannot find the file.
... omit ...

but 2.4.0 was facing the NPE

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.4.0:buildTar (default-cli) on project
 jib: (null exception message): NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.4.0:buildTar (default-cli) on project jib: (null exception message)
    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:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: (null exception message)
    at com.google.cloud.tools.jib.maven.BuildTarMojo.execute (BuildTarMojo.java:140)
    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:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NullPointerException
    at java.lang.String.<init> (String.java:561)
    at com.google.cloud.tools.jib.registry.credentials.DockerConfigCredentialRetriever.retrieve (DockerConfigCredentialRetriever.java:146)
    at com.google.cloud.tools.jib.registry.credentials.DockerConfigCredentialRetriever.retrieve (DockerConfigCredentialRetriever.java:104)
    at com.google.cloud.tools.jib.frontend.CredentialRetrieverFactory.lambda$dockerConfig$4 (CredentialRetrieverFactory.java:277)
    at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.retrieve (RegistryCredentialRetriever.java:47)
    at com.google.cloud.tools.jib.builder.steps.RegistryCredentialRetriever.getBaseImageCredential (RegistryCredentialRetriever.java:34)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call (PullBaseImageStep.java:134)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call (PullBaseImageStep.java:56)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:69)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)

@ahoehma
Copy link
Author

ahoehma commented Jun 19, 2020

I'm able to run now my build ....

jib:build -Djib.to.credHelper=ecr-login.exe

works for me.

I removed all the auth-stuff from my pom.xml:

<plugin>
          <groupId>com.google.cloud.tools</groupId>
          <artifactId>jib-maven-plugin</artifactId>
          <configuration>
            <!-- <from> -->
            <!-- <image>gcr.io/distroless/java:debug</image> -->
            <!-- </from> -->
            <to>
              <image>${aws.ecr.url}/${finalName}:latest</image>
            </to>
            <container>
              <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
              <ports>
                <port>8080</port>
              </ports>
            </container>
          </configuration>
        </plugin>

@chanseokoh
Copy link
Member

@ahoehma thanks for the update.
@Gsealy filed #2535 for your issue.

@chanseokoh
Copy link
Member

chanseokoh commented Aug 7, 2020

@ahoehma Jib Maven 2.5.2 and Jib Gradle 2.5.0 are released with the fix. You will no longer need to explicitly append .exe with 2.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants