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

Jenkins needs to check whether the war's directory is writeable before offering to upgrade

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Lifecycle#canRewriteHudsonWar assumes in-place replacement of the war, while UpdateCenter#download actually writes to a temporary file first to prevent breaking the file if an error occurs. This can lead to the following exception:

      hudson.util.IOException2: Failed to download from http://updates.jenkins-ci.org/download/war/1.570/jenkins.war (redirected to: http://jenkins.mirror.isppower.de/war/1.570/jenkins.war)
      	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:791)
      	at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1138)
      	at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1116)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:104)
      	at java.lang.Thread.run(Thread.java:744)
      Caused by: java.io.FileNotFoundException: /usr/lib/jenkins/jenkins.war.tmp (Permission denied)
      	at java.io.FileOutputStream.open(Native Method)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
      	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:762)
      	... 6 more

        Attachments

          Issue Links

            Activity

            Hide
            albers Harald Albers added a comment -

            Under which circumstances does such an error occur? How could I reproduce it?

            Show
            albers Harald Albers added a comment - Under which circumstances does such an error occur? How could I reproduce it?
            Hide
            danielbeck Daniel Beck added a comment - - edited

            Harald: For me, it was because I installed from RPM and decided I want Jenkins to be auto-upgradeable. So I ran chown jenkins /usr/lib/jenkins/jenkins.war. The button to Upgrade Automatically did appear, as did the exception after I clicked it. The jenkins user needs write access to the containing folder, as that is where the downloaded file is stored.

            An alternative solution have been to download to a guaranteed writable file in the temp dir, but being able to rename the .war to .bak (backup file) before upgrading seems like a good idea as well, so now the button only shows up when the folder is writable as well.

            Show
            danielbeck Daniel Beck added a comment - - edited Harald: For me, it was because I installed from RPM and decided I want Jenkins to be auto-upgradeable. So I ran chown jenkins /usr/lib/jenkins/jenkins.war . The button to Upgrade Automatically did appear, as did the exception after I clicked it. The jenkins user needs write access to the containing folder, as that is where the downloaded file is stored. An alternative solution have been to download to a guaranteed writable file in the temp dir, but being able to rename the .war to .bak (backup file) before upgrading seems like a good idea as well, so now the button only shows up when the folder is writable as well.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/hudson/lifecycle/Lifecycle.java
            http://jenkins-ci.org/commit/jenkins/b06e2aa3414d480d8b44459b0632226921be85f6
            Log:
            [FIXED JENKINS-23683] Check whether war's directory is writable

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/lifecycle/Lifecycle.java http://jenkins-ci.org/commit/jenkins/b06e2aa3414d480d8b44459b0632226921be85f6 Log: [FIXED JENKINS-23683] Check whether war's directory is writable
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            core/src/main/java/hudson/lifecycle/Lifecycle.java
            http://jenkins-ci.org/commit/jenkins/773144f0a1f786f50086bac6e3af65380ceff9fb
            Log:
            Merge pull request #1311 from daniel-beck/JENKINS-23683

            [FIXED JENKINS-23683] Check whether war's directory is writable

            Compare: https://github.com/jenkinsci/jenkins/compare/ca53100caea7...773144f0a1f7

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/lifecycle/Lifecycle.java http://jenkins-ci.org/commit/jenkins/773144f0a1f786f50086bac6e3af65380ceff9fb Log: Merge pull request #1311 from daniel-beck/ JENKINS-23683 [FIXED JENKINS-23683] Check whether war's directory is writable Compare: https://github.com/jenkinsci/jenkins/compare/ca53100caea7...773144f0a1f7
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #3499
            [FIXED JENKINS-23683] Check whether war's directory is writable (Revision b06e2aa3414d480d8b44459b0632226921be85f6)

            Result = SUCCESS
            daniel-beck : b06e2aa3414d480d8b44459b0632226921be85f6
            Files :

            • core/src/main/java/hudson/lifecycle/Lifecycle.java
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #3499 [FIXED JENKINS-23683] Check whether war's directory is writable (Revision b06e2aa3414d480d8b44459b0632226921be85f6) Result = SUCCESS daniel-beck : b06e2aa3414d480d8b44459b0632226921be85f6 Files : core/src/main/java/hudson/lifecycle/Lifecycle.java
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/hudson/lifecycle/Lifecycle.java
            http://jenkins-ci.org/commit/jenkins/2f718f4d1fbdc4147f590731de2d52f184241d88
            Log:
            [FIXED JENKINS-23683] Check whether war's directory is writable

            (cherry picked from commit b06e2aa3414d480d8b44459b0632226921be85f6)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/lifecycle/Lifecycle.java http://jenkins-ci.org/commit/jenkins/2f718f4d1fbdc4147f590731de2d52f184241d88 Log: [FIXED JENKINS-23683] Check whether war's directory is writable (cherry picked from commit b06e2aa3414d480d8b44459b0632226921be85f6)

              People

              • Assignee:
                danielbeck Daniel Beck
                Reporter:
                danielbeck Daniel Beck
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: