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
k8s:build failed because .git folder is copied to target #590
Comments
Thanks @manusa . Any workaround you can recommend ? Because it makes it unusable for the moment 😟 |
Don't use the simplified Dockerfile workflow. So probably your project looks like: https://github.com/eclipse/jkube/tree/master/quickstarts/maven/docker-file-simple If you use any of the other approaches in any of the 4 profiles of https://github.com/eclipse/jkube/tree/master/quickstarts/maven/docker-file-provided you should be fine. |
OK; just saw your reproducer project. |
Thanks @manusa. Your tip works fine. |
I have the same problem.
EDIT: I found out that the excludes are applied to late to avoid the .git folder error. Alle resources are copied first to the output directory and then the exclusions are deleted. But in between these two steps the error with the .git folder is thrown. To avoid that, the includes can be used. Unlike the exclude only the resources that are included are copied in the build step. |
This issue should be fixed in the latest 1.2.0 release. Could you please confirm? |
I can't confirm. The problem persists with v1.2.0 in s2i local build with excludes like in my example above.
|
@ochstobi : Could you please try creating |
@rohanKanojia I confirm that this is working. But only for
|
Are you sure about that? For me all specified folders seem to be getting ignored. I tested this on https://github.com/r0haaaan/jkube-dockerfile-test project which has this
I do
I modify my
When I run
|
Please also confirm your OS |
I am working on Windows 10. Sorry I did a mistake before. In fact the My
and is located in /cicd/openshift/.jkube-dockerignore (same folder als the pom.xml which is executing the plugin). I have the following structure:
This is my fileset for the openshift-maven-plugin step:
Maybe the |
I haven't checked our code, but I suspect it might have something to do with line separators (could you switch your file from CRLF to LF [if that is the case] and see if it works as expected?) |
@manusa Sadly this ends in the same output. |
Yes, we checked the code and we're using the nio Files helper class to read the file entries. However, if you're still using the configuration provided in this comment, then the issue has nothing to do with the In your case, you really need to provide the |
@manusa Thanks for this clarification. I apologize for the trouble. |
OK, no problem. Just confirm to us if once you configure the excludes in your XML config, it works OK. |
I have tested it and found out some things. First of all the exclusions are working but not correctly. In the
To dig a bit deeper I deleted the
So exclusions should be prevented from copying to the target. And the syntax for globs should be improved. I would expect that I hope this helps. |
Remember that the syntax for the exclusions is based on FileSystem.html#getPathMatcher. Since you're on a Windows platform, try using |
It seems that maven doesn't care. I tried and the results are the same. |
This issue should be fixed after #693 @ochstobi could you please confirm everything works now as expected? In order to test this I used the following settings with the maven/xml-config quickstart: <repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</pluginRepository>
</pluginRepositories>
<!-- ... -->
<plugins>
<plugin>
<groupId>com.github.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>master-SNAPSHOT</version>
<configuration>
<!-- ... -->
<fileSet>
<directory>${project.basedir}/../../..</directory>
<outputDirectory>.</outputDirectory>
<excludes>
<exclude>.git{/**,}</exclude>
<exclude>**/target/**</exclude>
<exclude>ide-config{/**,}</exclude>
<exclude>.idea{/**,}</exclude>
<exclude>.circleci{/**,}</exclude>
<exclude>quickstarts{/**,}</exclude>
</excludes>
</fileSet>
</configuration>
</plugin>
</plugins> |
Where can I get the version "master-SNAPSHOT" to test it? Can't find it in maven central. |
Just configure the plugin as described in my previous comment. Note that the Maven GAV coordinates change and that you need to add the Jitpack repository. |
Sadly I don't have access to jitpack repository in my environment. So I can only test it after the offical release. |
Well, you can always clone and install locally 😉 |
We just released 1.3.0, could you please confirm you can no longer reproduce this issue? |
@manusa I can confirm that this is working now. Great work! |
Description
The k8s:build action copies the .git folder to target and then failed to build the docker image.
Info
mvn -v
) :Kubernetes / Red Hat OpenShift setup and version : 1.20
If it's a bug, how to reproduce :
Clone a git repository. Then, execute the k8s:build action. The following error is shown:
To reproduce the issue, you can use the attached project. Then do:
jkube-test.zip
The text was updated successfully, but these errors were encountered: