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

Delete workspace with sudo doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • ws-cleanup-plugin
    • None
    • Ubuntu 12.04 LTS
      Jenkins WAR v1.559
      ws-clean plug-in v0.20

      Some projects create root owned files in the project's work directory. The project work space cannot be cleaned up using ws-cleanup plugin before building the project again, because root-owned files cannot be deleted.

      Here are the steps to test:
      1. Select "Delete workspace before build starts
      2. Clicking "Advanced" button
      3. Enter command "sudo rm -rf %s" into "External Deletion Command".
      4. Add build step to do "ls -alF" so that you can see if the previous build's files exists or did the clean-up work.
      5. Start rebuilding the project.

      I have tried this on a slave host and it doesn't work there, at least.

      The jenkins-user is in sudoers file (in the slave host) and sudo is configured not to require password.

      An interesting detail is that the "/var/log/auth.log" shows a log row for a correct command-line, but that still doesn't work:

      Apr 21 03:30:06 imx7 sudo:  jenkins : TTY=unknown ; PWD=/var/lib/jenkins ; USER=root ; COMMAND=/bin/rm -rf "/var/lib/jenkins/workspace/my-test-project-with-root-owned-files"
      

            vjuranek vjuranek
            hartsan Harry Flink
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: