Open jakub-bochenski opened 6 years ago
I've checked that the files are already missing docker-build.tar
$ tar -tvf target/docker/samples/demp-sample-zero-config/0.27.2/tmp/docker-build.tar
-rw-rw-r-- bochja/bochja 69 2018-11-14 15:55 Dockerfile
drwxrwxr-x bochja/bochja 0 2018-11-14 15:55 target/
-rw-rw-r-- bochja/bochja 944 2018-11-14 15:50 pom.xml
lrwxrwxrwx bochja/bochja 0 2018-11-14 15:06 relative.link -> file
lrwxrwxrwx bochja/bochja 0 2018-11-14 15:06 absolute.link -> /home/bochja/tmp/linktest/file
-rw-rw-r-- bochja/bochja 0 2018-11-14 15:06 file
@rhuss some pointers on how to fix this would be appreciated, I expect it's some simple configuration option
Sorry for the late response, November is crazy busy with travelling for me. Actually I think this should be an option in the Maven archiver used for creating that tar, so that symlinks get resolved before being included into the tar. Need to check that, but I'm afraid can' t do it before mid December. Please ping me again in case I should forget it.
I tried to follow your lead, but I see that since 3.5 the plexus archiver is not following symlinks: https://github.com/codehaus-plexus/plexus-archiver/commit/def8cab5b8496f7735f21a792619060d72958f59
I think it has to be something else, do you have any other hints? :)
can' t do it before mid December. Please ping me again in case I should forget it.
Ping @rhuss Please note the post above about the plexus-archiver lead.
Actually I could track down the issue to the Archiver which uses a DirectoryScanner
which in turn is responsible for picking up the images. It has a loop like:
for ( String newfile : newfiles )
{
if ( file.isDirectory() )
{
// ....
}
else if ( file.isFile() )
{
// ......
}
}
Unfortunately, java.io.File
returns false
for a symlink which does not point to a real file (true
for an existing link).
I'm afraid that there is not much I can do here as it is burried deep in the libraries (plexus, Java SDK) which we are using and fixing this would require a major refactoring.
I'm out of ideas how to fix this without doing a massive change of the code base. Do you have any idea ?
I should have just tried building a .tar with the assembly plugin earlier -- sorry about not doing that.
I think it's a valid issue that could be reported to plexus-utils, but I wouldn't expect a fix any time soon.
I'm out of ideas how to fix this without doing a massive change of the code base. Do you have any idea ?
There are some workarounds if you go outside the plugin. An obvious one would be to tar the contents from command line (exec plugin etc.) and use ADD instead of COPY to extract it.
For my case I think the best I can do is just do a RUN ln ...
inside the Dockerfile instead. (I prefer to prepare the directory structure outside and just copy it whole into the docker context).
PS. What I find really strange here is that apparently nobody ever hit this issue before.
Another thought: maybe it would be worth checking out how https://github.com/mojohaus/rpm-maven-plugin is handling this. (Specifically http://www.mojohaus.org/rpm-maven-plugin/map-params.html)
Description
Symlinks might not point to anything on the host system, but be useful inside the container.
More importantly this is different from the standard Docker behavior.
Info
d-m-p version : 0.27.2
Maven version (
mvn -v
) : 3.5.2Docker version : 18.06.1-ce
Sample project : https://github.com/jakub-bochenski/demp-link-problem/tree/master/test
Check the sample output in https://github.com/jakub-bochenski/demp-link-problem/blob/master/README.md