Closed aniketb1985 closed 3 years ago
Do you think this can be related to #544? (is your setup based on a Dockerfile living in your project's root path?)
Yes that is right. It is based on Dockerfile based on the root path.
We'll consider this a duplicate of #544.
I'm closing to keep everything related to this issue in #544. If the solution we provide for that issue doesn't work for you, feel free to open a new one.
Just to clarify, by solution you mean the work around...right?
You can use the workaround now (please confirm if that works for you).
But we will provide a solution that doesn't require a workaround too (hopefully in our next release)
Thank you Marc. When I run the given example - https://github.com/eclipse/jkube/tree/5703f015643c70a6043a86d4ed6eb27521d5a381/quickstarts/maven/docker-file-provided on my local windows I get the below WARNING. Is this expected?
[WARNING] The requested profile "'docker-file'" could not be activated because it does not exist.
And when I ran on Jenkins I got the same error:
[DEBUG] Trying to configure client from Kubernetes config...
[DEBUG] Did not find Kubernetes config at: [/var/lib/jenkins/.kube/config]. Ignoring.
[DEBUG] Trying to configure client from service account...
[DEBUG] Did not find service account ca cert at: [/var/run/secrets/kubernetes.io/serviceaccount/ca.crt].
[WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
[DEBUG] Trying to configure client namespace from Kubernetes service account namespace path...
[DEBUG] Did not find service account namespace at: [/var/run/secrets/kubernetes.io/serviceaccount/namespace]. Ignoring.
[WARNING] k8s: Cannot access cluster for detecting mode: Unknown host kubernetes.default.svc: Name or service not known
[DEBUG] Trying to configure client from Kubernetes config...
[DEBUG] Did not find Kubernetes config at: [/var/lib/jenkins/.kube/config]. Ignoring.
[DEBUG] Trying to configure client from service account...
[DEBUG] Did not find service account ca cert at: [/var/run/secrets/kubernetes.io/serviceaccount/ca.crt].
[WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
[DEBUG] Trying to configure client namespace from Kubernetes service account namespace path...
[DEBUG] Did not find service account namespace at: [/var/run/secrets/kubernetes.io/serviceaccount/namespace]. Ignoring.
[INFO] k8s: Running in Kubernetes mode
[INFO] k8s: Building Docker image in Kubernetes mode
[INFO] k8s: Generators:
[INFO] k8s: - quarkus
[INFO] k8s: - spring-boot
[INFO] k8s: - wildfly-swarm
[INFO] k8s: - thorntail-v2
[INFO] k8s: - wildfly-jar
[INFO] k8s: - openliberty
[INFO] k8s: - karaf
[INFO] k8s: - vertx
[INFO] k8s: - java-exec
[INFO] k8s: - webapp
[DEBUG] k8s: Build args set {}
[DEBUG] k8s: Build args set {}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.760 s
[INFO] Finished at: 2021-02-02T01:52:18-05:00
[INFO] Final Memory: 86M/360M
[INFO] ------------------------------------------------------------------------
[INFO] [jenkins-event-spy] Generated
[ERROR] Java heap space -> [Help 1]
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3236)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:86)
at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:60)
at org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:226)
at org.eclipse.jkube.kit.common.archive.JKubeTarArchiver.createTarBall(JKubeTarArchiver.java:78)
at org.eclipse.jkube.kit.build.api.assembly.JKubeBuildTarArchiver.createArchive(JKubeBuildTarArchiver.java:79)
at org.eclipse.jkube.kit.build.api.assembly.AssemblyManager.createBuildTarBall(AssemblyManager.java:231)
at org.eclipse.jkube.kit.build.api.assembly.AssemblyManager.createDockerTarArchive(AssemblyManager.java:110)
at org.eclipse.jkube.kit.build.service.docker.ArchiveService.createArchive(ArchiveService.java:118)
at org.eclipse.jkube.kit.build.service.docker.ArchiveService.createArchive(ArchiveService.java:113)
at org.eclipse.jkube.kit.build.service.docker.BuildService.buildImage(BuildService.java:130)
at org.eclipse.jkube.kit.build.service.docker.BuildService.buildImage(BuildService.java:77)
at org.eclipse.jkube.kit.config.service.kubernetes.DockerBuildService.build(DockerBuildService.java:44)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.buildAndTag(AbstractDockerMojo.java:658)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.processImageConfig(AbstractDockerMojo.java:499)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.executeBuildGoal(AbstractDockerMojo.java:628)
at org.eclipse.jkube.maven.plugin.mojo.build.BuildMojo.executeInternal(BuildMojo.java:49)
at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.execute(AbstractDockerMojo.java:440)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError
[Pipeline] }
The profile is not being detected, what command are you running exactly?
I tried with both the commands below:
mvn clean -X package k8s:build -P'context-dir'
mvn clean -X package k8s:build -P'docker-file'
Try removing the single quote, maybe that has problems in windows.
Thank you. That worked on windows. Will let you know the results on Jenkins.
@manusa - It looks when we add repackage goal for spring boot as shown below.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
Posting the error again for for reference:
[INFO] k8s: Running in Kubernetes mode [INFO] k8s: Building Docker image in Kubernetes mode [DEBUG] k8s: Build args set {} [DEBUG] k8s: Build args set {} [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:43 min [INFO] Finished at: 2021-02-02T07:55:04-05:00 [INFO] Final Memory: 90M/357M [INFO] ------------------------------------------------------------------------ [ERROR] Java heap space -> [Help 1] java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3236) at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118) at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93) at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153) at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:86) at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:60) at org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:226) at org.eclipse.jkube.kit.common.archive.JKubeTarArchiver.createTarBall(JKubeTarArchiver.java:78) at org.eclipse.jkube.kit.build.api.assembly.JKubeBuildTarArchiver.createArchive(JKubeBuildTarArchiver.java:79) at org.eclipse.jkube.kit.build.api.assembly.AssemblyManager.createBuildTarBall(AssemblyManager.java:231) at org.eclipse.jkube.kit.build.api.assembly.AssemblyManager.createDockerTarArchive(AssemblyManager.java:110) at org.eclipse.jkube.kit.build.service.docker.ArchiveService.createArchive(ArchiveService.java:118) at org.eclipse.jkube.kit.build.service.docker.ArchiveService.createArchive(ArchiveService.java:113) at org.eclipse.jkube.kit.build.service.docker.BuildService.buildImage(BuildService.java:130) at org.eclipse.jkube.kit.build.service.docker.BuildService.buildImage(BuildService.java:77) at org.eclipse.jkube.kit.config.service.kubernetes.DockerBuildService.build(DockerBuildService.java:44) at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.buildAndTag(AbstractDockerMojo.java:658) at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.processImageConfig(AbstractDockerMojo.java:499) at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.executeBuildGoal(AbstractDockerMojo.java:628) at org.eclipse.jkube.maven.plugin.mojo.build.BuildMojo.executeInternal(BuildMojo.java:49) at org.eclipse.jkube.maven.plugin.mojo.build.AbstractDockerMojo.execute(AbstractDockerMojo.java:440) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError [Pipeline] }
Description
Getting below error while running command: mvn clean package k8s:build
Tried setting the maven opts to -Xmx4g but Jkube is not picking. Is there any specific way to add the maven opts?
Info
mvn -v
) : 3.3.3