Search code examples
jenkinsjenkins-pluginscloudbees

CloudBees Back-up Plugin failing


Below is the error message I'm receiving. The master is running on OpenSUSE and my Jenkins version is "Jenkins ver. 1.466.12.1 (Jenkins Enterprise by CloudBees 12.11)".

I've verified that I can create a file on the linux box in /mnt/jenkinsbackup. Is this a user permission problem?

Building on master in workspace /var/lib/jenkins/jobs/Jenkins Backup/workspace java.io.FileNotFoundException: /mnt/jenkinsbackup/backup-Jenkins Backup-19.tar.gz (Permission denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.(FileOutputStream.java:209) at java.io.FileOutputStream.(FileOutputStream.java:160) at com.infradna.hudson.plugins.backup.store.LocalFileStore$1._backup(LocalFileStore.java:50) at com.infradna.hudson.plugins.backup.store.BackupFile.backup(BackupFile.java:25) at com.infradna.hudson.plugins.backup.BackupBuilder.perform(BackupBuilder.java:95) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710) at hudson.model.Build$RunnerImpl.build(Build.java:178) at hudson.model.Build$RunnerImpl.doRun(Build.java:139) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480) at hudson.model.Run.run(Run.java:1438) at hudson.model.Build.run(Build.java:110) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:239) Build step 'Take backup' changed build result to FAILURE Finished: FAILURE

EDIT: I forgot to mention that I am running jenkins as a daemon and not as a user.


Solution

  • The permission problem stemmed from the mounted network folder. Only root had permission to write to it. One suggestion I found on the internet was to change the ownership of the folder to jenkins:nogroup (since that is what the Jenkins master is running as), but you can't do that to a mounted folder.

    But that led me to changing the permissions when mounting the folder in the first place. I learned I could do this:

    mount -t cifs //network_folder_path/jenkins /mnt/jenkins -o username=USERNAME,password=XXXX,dir_mode=0777,file_mode=0777

    That mounted the folder with write permissions for everyone and the job was able to run.