spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

gitlab ci not execute deploy with docker maven plugin #452

Open lacerdanycolas opened 3 years ago

lacerdanycolas commented 3 years ago

I want build docker image, and deploy for gcloud in gitlab ci but i got this exception. I followed the sugestion in #372 what is wrong?

Software:

Full backtrace

INFO] Using Google credentials from file: /tmp/credentials.json
[INFO] loaded credentials for service account with clientEmail=local-auth@test-p2f-dev.iam.gserviceaccount.com
[INFO] dockerfile: null
[INFO] contextDirectory: /builds/p2f/desenvolvimento/p2f-back/discovery-service
[INFO] Building Docker context /builds/p2f/desenvolvimento/p2f-back/discovery-service
[INFO] Path(dockerfile): null
[INFO] Path(contextDirectory): /builds/p2f/desenvolvimento/p2f-back/discovery-service
[INFO] 
[INFO] Image will be built as us-east1-docker.pkg.dev/test-p2f-dev/test-p2f-shared/bpms-discovery:0.0.1
[INFO] 
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
    at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:247)
    at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)
    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 jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    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.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: com.spotify.docker.client.shaded.org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1] failed: Connection refused
    at com.spotify.docker.client.DefaultDockerClient.propagate (DefaultDockerClient.java:2848)
    at com.spotify.docker.client.DefaultDockerClient.request (DefaultDockerClient.java:2712)
    at com.spotify.docker.client.DefaultDockerClient.version (DefaultDockerClient.java:600)
    at com.spotify.docker.client.DefaultDockerClient.authRegistryHeader (DefaultDockerClient.java:2891)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1498)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1465)
    at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:240)
    at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)
    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 jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    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: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: com.spotify.docker.client.shaded.org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1] failed: Connection refused
    at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.getValue (AbstractFuture.java:299)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get (AbstractFuture.java:286)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get (AbstractFuture.java:116)
    at com.spotify.docker.client.DefaultDockerClient.request (DefaultDockerClient.java:2710)
    at com.spotify.docker.client.DefaultDockerClient.version (DefaultDockerClient.java:600)
    at com.spotify.docker.client.DefaultDockerClient.authRegistryHeader (DefaultDockerClient.java:2891)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1498)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1465)
    at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:240)
    at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)
    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 jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:78)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    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.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: com.spotify.docker.client.shaded.org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1] failed: Connection refused
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:481)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector$1.run (ApacheConnector.java:491)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute (MoreExecutors.java:299)
    at java.util.concurrent.AbstractExecutorService.submit (AbstractExecutorService.java:123)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit (AbstractListeningExecutorService.java:50)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit (AbstractListeningExecutorService.java:37)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:487)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$2.run (ClientRuntime.java:178)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:271)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:315)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:297)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.process.internal.RequestScope.runInScope (RequestScope.java:340)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$3.run (ClientRuntime.java:210)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1130)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:630)
    at java.lang.Thread.run (Thread.java:831)
Caused by: com.spotify.docker.client.shaded.org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1] failed: Connection refused
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:151)
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect (PoolingHttpClientConnectionManager.java:353)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:380)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:236)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:184)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:88)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:110)
    at com.spotify.docker.client.shaded.org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:184)
    at com.spotify.docker.client.shaded.org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:71)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:435)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector$1.run (ApacheConnector.java:491)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute (MoreExecutors.java:299)
    at java.util.concurrent.AbstractExecutorService.submit (AbstractExecutorService.java:123)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit (AbstractListeningExecutorService.java:50)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit (AbstractListeningExecutorService.java:37)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:487)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$2.run (ClientRuntime.java:178)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:271)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:315)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:297)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.process.internal.RequestScope.runInScope (RequestScope.java:340)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$3.run (ClientRuntime.java:210)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1130)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:630)
    at java.lang.Thread.run (Thread.java:831)
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.Net.pollConnect (Native Method)
    at sun.nio.ch.Net.pollConnectNow (Net.java:669)
    at sun.nio.ch.NioSocketImpl.timedFinishConnect (NioSocketImpl.java:542)
    at sun.nio.ch.NioSocketImpl.connect (NioSocketImpl.java:597)
    at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:333)
    at java.net.Socket.connect (Socket.java:645)
    at com.spotify.docker.client.shaded.org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket (PlainConnectionSocketFactory.java:74)
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:134)
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect (PoolingHttpClientConnectionManager.java:353)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:380)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:236)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:184)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:88)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:110)
    at com.spotify.docker.client.shaded.org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:184)
    at com.spotify.docker.client.shaded.org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:71)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:435)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector$1.run (ApacheConnector.java:491)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute (MoreExecutors.java:299)
    at java.util.concurrent.AbstractExecutorService.submit (AbstractExecutorService.java:123)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit (AbstractListeningExecutorService.java:50)
    at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit (AbstractListeningExecutorService.java:37)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply (ApacheConnector.java:487)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$2.run (ClientRuntime.java:178)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:271)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:315)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:297)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process (Errors.java:267)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.process.internal.RequestScope.runInScope (RequestScope.java:340)
    at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$3.run (ClientRuntime.java:210)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1130)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:630)
    at java.lang.Thread.run (Thread.java:831)

.gitlab-ci.yml

image: markhobson/maven-chrome:jdk-16

test:
  stage: test
  only:
    - master
  script:
    - mvn clean test

services:
  - docker:dind
variables:
  DOCKER_HOST: tcp://docker:2375
  DOCKER_DRIVER: overlay2

deploy:
  stage: deploy
  environment: Production
  only:
    - master
  script:
    - touch /tmp/credentials.json
    - export DEST_DIR=/tmp/credentials.json
    - echo $SERVICE_ACCOUNT > $DEST_DIR
    - export DOCKER_GOOGLE_CREDENTIALS="/tmp/credentials.json"
    - echo $DOCKER_GOOGLE_CREDENTIALS
    - mvn deploy
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.