Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-16426

Backup fails while copying a file from the jobs folder

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • thinbackup-plugin
    • None
    • Windows Server 2008 R2 64bit, Tomcat 7

      It looks like the backup plugin tries to copy a directory instead of a file and stops the backup at this point. Also the configured compression to zip files wasn't working, probably due to the exception.

      Jan 21, 2013 5:00:34 AM org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup backupJobsDirectory
      INFO: Found 31 jobs to back up.
      Jan 21, 2013 5:00:34 AM org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup backupJobsDirectory
      INFO: Found 347 jobs to back up.
      Jan 21, 2013 5:00:36 AM org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup backupJobsDirectory
      INFO: Found 36 jobs to back up.
      Jan 21, 2013 5:00:38 AM org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork backupNow
      SEVERE: Cannot perform a backup. Please be sure jenkins/hudson has write privileges in the configured backup path 'D:\backup\jenkins'.
      java.io.IOException: Source 'd:\jenkins\jobs\settings-XYZ.xml' exists but is not a directory
      at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:869)
      at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:814)
      at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJobConfigFor(HudsonBackup.java:240)
      at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJob(HudsonBackup.java:201)
      at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJobsDirectory(HudsonBackup.java:190)
      at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backupJobs(HudsonBackup.java:169)
      at org.jvnet.hudson.plugins.thinbackup.backup.HudsonBackup.backup(HudsonBackup.java:136)
      at org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork.backupNow(ThinBackupPeriodicWork.java:87)
      at org.jvnet.hudson.plugins.thinbackup.ThinBackupPeriodicWork.execute(ThinBackupPeriodicWork.java:68)
      at org.jvnet.hudson.plugins.thinbackup.hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:54)
      at java.lang.Thread.run(Thread.java:722)

      I haven't recognized this issue immediately, because a full backup and 6 incremental backups were partially stored in the backup folder. It would be helpful to show an error on the thinBackup Jenkins page, if a backup failed due to any issue.

          [JENKINS-16426] Backup fails while copying a file from the jobs folder

          Thomas Fürer added a comment -

          Why do you have a xml file in the jobs directory. normally there are only folders in there. can you please tell me which plugins you use and which of it will store files in the jobs directory, or why this file is placed in this folder?

          Thomas Fürer added a comment - Why do you have a xml file in the jobs directory. normally there are only folders in there. can you please tell me which plugins you use and which of it will store files in the jobs directory, or why this file is placed in this folder?

          Code changed in jenkins
          User: tofuatjava
          Path:
          pom.xml
          src/main/java/org/jvnet/hudson/plugins/thinbackup/backup/HudsonBackup.java
          http://jenkins-ci.org/commit/thin-backup-plugin/cfe9e2dc71f92e2bc291798fd2ea16dfcb7515f0
          Log:
          JENKINS-16426: back up only directorys in the job directory

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: tofuatjava Path: pom.xml src/main/java/org/jvnet/hudson/plugins/thinbackup/backup/HudsonBackup.java http://jenkins-ci.org/commit/thin-backup-plugin/cfe9e2dc71f92e2bc291798fd2ea16dfcb7515f0 Log: JENKINS-16426 : back up only directorys in the job directory

          We had stored some Maven settings.xml files within the jobs directory (just to use the same configuration in multiple build jobs). There are no files which were generated by any of our Jenkins plugins.

          As I have seen, the above commit is now ignoring the files, which should of course also be saved in the backups. We have now temporarily copied the files to the build job directories, but would appreciate to have the ability to move them back to the jobs folder. Is there any reason why files shouldn't be stored in this directory? Or should we use another subdirectory of the Jenkins root folder, which is automatically saved in the backups?

          Christian Apel added a comment - We had stored some Maven settings.xml files within the jobs directory (just to use the same configuration in multiple build jobs). There are no files which were generated by any of our Jenkins plugins. As I have seen, the above commit is now ignoring the files, which should of course also be saved in the backups. We have now temporarily copied the files to the build job directories, but would appreciate to have the ability to move them back to the jobs folder. Is there any reason why files shouldn't be stored in this directory? Or should we use another subdirectory of the Jenkins root folder, which is automatically saved in the backups?

          Thomas Fürer added a comment -

          There is no special reason why I would not include files in the job directory to the back up. The idea of thinBackup is to back up only a minimum set of configuration to keep it small and handy. As normally the jobs folder is under control of jenkins. I never would put files in this folder by my own. However, you have done it. I suggest to put the configurations under JENKINS_HOME (where all other global configurations are placed), alternativly I would suggest the userContent folder.
          Including files in the job folder to the backup will also open the question why not include files in other jenkins controlled folders. So this will open a neverending task because several plugins (e.g. CloudBees Folders or Matrix Job Configuration) will have their own folder structure, which makes it complicated to back up only a minimal set of files.

          Is, moving the files to the suggested folders, an option for you? If not I need to refactor some code and redefine some ideas, technical it is possible, but I'm not sure if I should do it at the moment.

          Thomas Fürer added a comment - There is no special reason why I would not include files in the job directory to the back up. The idea of thinBackup is to back up only a minimum set of configuration to keep it small and handy. As normally the jobs folder is under control of jenkins. I never would put files in this folder by my own. However, you have done it. I suggest to put the configurations under JENKINS_HOME (where all other global configurations are placed), alternativly I would suggest the userContent folder. Including files in the job folder to the backup will also open the question why not include files in other jenkins controlled folders. So this will open a neverending task because several plugins (e.g. CloudBees Folders or Matrix Job Configuration) will have their own folder structure, which makes it complicated to back up only a minimal set of files. Is, moving the files to the suggested folders, an option for you? If not I need to refactor some code and redefine some ideas, technical it is possible, but I'm not sure if I should do it at the moment.

          Thanks for your detailed explanation. These files are more related to the job configurations but not to the global Jenkins configuration. I think that it's a good idea to move them to the userContent folder.

          Christian Apel added a comment - Thanks for your detailed explanation. These files are more related to the job configurations but not to the global Jenkins configuration. I think that it's a good idea to move them to the userContent folder.

          Thomas Fürer added a comment - - edited

          problem is fix and workaround for special case is to move files to the userContent folder.

          if this is still a problem for you do not hesitate to reopen this issue. Than I will implement the inclution of these files.

          Thanks for your feedback!

          Thomas Fürer added a comment - - edited problem is fix and workaround for special case is to move files to the userContent folder. if this is still a problem for you do not hesitate to reopen this issue. Than I will implement the inclution of these files. Thanks for your feedback!

            tofuatjava Thomas Fürer
            christianapel Christian Apel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: