question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

extraDirectory doesn't work with symbolic links as either destination or source

See original GitHub issue

Description of the issue: I have a maven project structure and have used the default jib location of extraDirectory.

src/main/jib/ Added my desired file i.e. ‘server.xml’ that needed to be placed under ‘/config’ within the base image. Thus, the structure now looked like this: (As jib requires recreating the structure under ‘jib’ directory)

src/main/jib/config/server.xml

The destination directory ‘/config’ is actually a symbolic link in the base image. After jib creates the image, on inspecting it can be seen that the symbolic link has now got replaced with an actual directory. Which breaks the build for me.

Expected behavior:

Symbolic link directories are typical in Java EE server images where these links are provided for deployment or configuration file placement. Here the ‘config’ directory is the case for openliberty server.

Would expect this structure to be preserved if possible. Or provide some means of achieving the goal of putting files under images which use a symbolic link as a destination folder.

Environment: Maven 3.5 Java 8 OS - MacOS

jib-maven-plugin Configuration:

<plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>1.0.2</version>
                <configuration>
                    <from>
                        <image>openliberty/open-liberty:javaee8-java8-openj9</image>
                    </from>
                    <to>
                        <image>demo-project:1.0</image>
                    </to>
                    <container>
                        <appRoot>/apps/</appRoot>                        
                    </container>
                </configuration>
            </plugin>

Additional Information: I inspected the image by logging into it with bash (running container). And I can see that the symbolic link ‘config’ within the server, now got changed to an actual directory.

Let me know if you need more details? This actually should be easily reproducible without requiring any Java or server technology, it’s just a matter of how JIB copies the structure on the base image.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
briandealwiscommented, Mar 27, 2019

I’m going to re-open this as there’s a workaround but not a solution. If others encounter this issue, please describe your situation here.

0reactions
chanseokohcommented, Nov 24, 2021

So there are two sides of the issue:

  1. source symlinks (creating symlinks in an image): as suggested in https://github.com/GoogleContainerTools/jib/issues/1576#issuecomment-503810403 and supported in Bazel rules_docker, it sounds like a good idea to support this. Note this is really #2275.
  2. destination symlinks (following symlinks in a base image when copying files from <extraDirectories>): this is tough to support. We may need to list file contents of base image layers, statically analyze symlinks, and put files in correct destination directories.
Read more comments on GitHub >

github_iconTop Results From Across the Web

cp into destination hierarchy with symbolic link? - Super User
I want the files in SOURCE html to go to DEST /var/www/ftproot/mysite . The script was: cd SOURCE cp -Rf * DEST. Every...
Read more >
Solving the “Too many levels of symbolic links” Error - Baeldung
Learn two ways to solve the "Too many levels of symbolic links" error. ... ln shows the source as TARGET and the destination...
Read more >
Manual - luckyBackup - backup and sync utility
Remote connections are possible, either for use as a source or as a destination. Also execute. You can execute any command(s) before or...
Read more >
How does Git handle symbolic links? - Stack Overflow
If you delete the file that the symlink references it doesn't ... It is up to the user to either remove or change...
Read more >
Symbolic Links (The GNU C Library)
You can also make a symbolic link to a name which is not the name of any file. ... The reason symbolic links...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found