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

Since version 0.45 build fails Unable to build image, failed to resolve source metadata for and no active sessions #1811

Open
nudgegoonies opened this issue Aug 1, 2024 · 7 comments

Comments

@nudgegoonies
Copy link

nudgegoonies commented Aug 1, 2024

Description

Since version 0.45 the build of an internal project using an internal docker repository (Artifactory) fails pulling the base image used in our Dockerfile processed by docker-maven-plugin. Managing the plugin back to 0.44 is our current workaround.

The maven build log part:

1986 [ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.45.0:build (docker-build) on project mampkg-npm-cache: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions"  -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.45.0:build (docker-build) on project mampkg-npm-cache: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:305)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.buildImage (DockerAccessWithHcClient.java:297)
    at io.fabric8.maven.docker.service.BuildService.doBuildImage (BuildService.java:292)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:182)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:70)
    at io.fabric8.maven.docker.BuildMojo.proceedWithDockerBuild (BuildMojo.java:110)
    at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:91)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:84)
    at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:163)
    at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:73)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:302)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: io.fabric8.maven.docker.access.DockerAccessException: "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    at io.fabric8.maven.docker.access.chunked.BuildJsonResponseHandler.process (BuildJsonResponseHandler.java:26)
    at io.fabric8.maven.docker.access.chunked.EntityStreamReaderUtil.processJsonStream (EntityStreamReaderUtil.java:27)
    at io.fabric8.maven.docker.access.hc.HcChunkedResponseHandlerWrapper.handleResponse (HcChunkedResponseHandlerWrapper.java:44)
    at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate$StatusCodeCheckerResponseHandler.handleResponse (ApacheHttpClientDelegate.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:223)
    at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:165)
    at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:140)
    at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate.post (ApacheHttpClientDelegate.java:109)
    at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.buildImage (DockerAccessWithHcClient.java:295)
    at io.fabric8.maven.docker.service.BuildService.doBuildImage (BuildService.java:292)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:182)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:70)
    at io.fabric8.maven.docker.BuildMojo.proceedWithDockerBuild (BuildMojo.java:110)
    at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:91)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:84)
    at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:163)
    at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:73)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:302)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
1988 [ERROR] 
1988 [ERROR] 
1988 [ERROR] For more information about the errors and possible solutions, please read the following articles:
1988 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
1988 [ERROR] 
1988 [ERROR] After correcting the problems, you can resume the build with the command
1988 [ERROR]   mvn <args> -rf :mampkg-npm-cache

Info

  • docker-maven-plugin version : 0.45
  • Maven version (mvn -v) :
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Maven home: /usr/local/share/apache-maven/apache-maven-3.9.8
Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-21-jdk-amd64
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "6.1.0-23-amd64", arch: "amd64", family: "unix"

  • Docker version : 27.1.1
  • If it's a bug, how to reproduce : I cannot provide a minimal example. Precondition is that the docker image is not available locally which always the case in our gitlab-ci setup.
@rohanKanojia
Copy link
Member

@nudgegoonies : Could you please provide more information on how to reproduce it? Could it be related to your Docker version? We have E2E tests that pull images on every run.

@rroesch1
Copy link

rroesch1 commented Aug 1, 2024

fyi: no active sessions is the error message you get from dockerd if you're trying to use buildkit without active grpc session.
For buildkit support the client (i.e. d-m-p) has to initialize a grpc sessions (see: Initialize interactive session API). As so far as i know d-m-p did not implement this Session API for now.

see: this comment

@rohanKanojia
Copy link
Member

@nudgegoonies : Are you using BuildX functionality?

@nudgegoonies
Copy link
Author

Yes, we use buildx functionality since it became the default last year. Especially the copy --chmod and --chown on one line.

@rohanKanojia
Copy link
Member

@nudgegoonies : Does your project work with v0.44.0 ?

Is it possible to share a sample Dockerfile that can reproduce the issue? I ran integration tests with Docker 27.1.1 and they seem to be passing

@rroesch1
Copy link

rroesch1 commented Aug 5, 2024

@rohanKanojia i have taken a closer look on what @nudgegoonies is doing (fyi: we are working in the same organization) and i think we identified the root cause of the "regressions":

  • He forcefully enabled buildkit by setting the buildOption version to 2 (this was intentional because the classic builder doesn't support the full Dockerfile syntax)
  • using buildkit for d-m-p may not work as already pointed out in feat: add support for dockerd Builder-Version header #1794 (but it may work as long as buildkit doesn't try to access the missing grpc session)
  • since d-m-p v0.45.0 the build does not longer work due to the mentioned exception.
  • the root cause for this is, that the d-m-p "auto pull feature" does no longer pull the image defined in the Dockerfile (build.dockerFile) but the image defined in build.from configuration.
  • build.from and build.dockerFile are both defined in the image configuration. The first on is explicitly defined, but the latter one was inherited from the parent POM.
  • the build is not failing because buildkit is trying to pull the image because the "correct" image has not been pulled beforehand by the d-m-p "auto pull". (For whatever reason buildkit cannot pull images without a grpc session)

@nudgegoonies
Copy link
Author

@rroesch1 already figured out the details. To answer the explicit question. Yes, it works with 0.44.

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

No branches or pull requests

3 participants