Reputation: 30801
We are running Jenkins 1.651.1 in a Docker container. On a certain moment we decided to move our containers to another environment.
We have a cron job which creates backups of the volume of our container:
tar -cvpzf jenkins-backup.tar -C jenkins-volume/_data/ . --exclude ".m2"
On the new environment we created a new jenkins docker volume:
docker volume create --name jenkins-volume
And we untar
our backup inside the volume + recreated a jenkins instance and connected it with the volume
Everything is working fine again except we sometimes get an unexpected 'error' message. It doesn't break anything but appears very often:
Started by user ********
ln builds/lastSuccessfulBuild /var/jenkins_home/jobs/xxx/lastSuccessful failed
java.nio.file.DirectoryNotEmptyException: /var/jenkins_home/jobs/xxx/lastSuccessful
at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at sun.reflect.GeneratedMethodAccessor473.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.Util.createSymlinkJava7(Util.java:1233)
at hudson.Util.createSymlink(Util.java:1151)
at hudson.model.Run.createSymlink(Run.java:1840)
at hudson.model.Run.updateSymlinks(Run.java:1821)
at hudson.model.Run.execute(Run.java:1736)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
ln builds/lastStableBuild /var/jenkins_home/jobs/xxx/lastStable failed
java.nio.file.DirectoryNotEmptyException: /var/jenkins_home/jobs/xxx/lastStable
at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at sun.reflect.GeneratedMethodAccessor473.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.Util.createSymlinkJava7(Util.java:1233)
at hudson.Util.createSymlink(Util.java:1151)
at hudson.model.Run.createSymlink(Run.java:1840)
at hudson.model.Run.updateSymlinks(Run.java:1822)
at hudson.model.Run.execute(Run.java:1736)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
[EnvInject] - Loading node environment variables.
Building in workspace /var/jenkins_home/jobs/xxx/workspace
> git rev-parse --is-inside-work-tree # timeout=10
... and it works further and fine
What is the best way to solve this?
Upvotes: 2
Views: 1207
Reputation: 384
As commented by CSchulz you can delete the directories and those will get created base on the result of the build.
This could also be because these are soft links & from the backup, these might be created as the directories. Hence, Jenkins not able to delete them. If you remove or rename these directories, Jenkins then can recreate the soft-links.
Upvotes: 2