install-plugin command can leave behind broken files

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Latest jenkins-cli.jar uses present working directory for temporary files when installing plugins, exploding spectacularly when a directory with the plugin name already exists.

      To reproduce, run:

      $ mkdir job-dsl
      $ java -jar /opt/jenkins-cli.jar -s http://localhost:8080/ install-plugin job-dsl
      
      Installing a plugin from local file: job-dsl
      Unexpected exception occurred while performing install-plugin command!
      java.io.IOException: Failed to copy job-dsl to /var/lib/jenkins/plugins/job-dsl.jpi
              at hudson.FilePath.copyTo(FilePath.java:1990)
              at hudson.cli.InstallPluginCommand.run(InstallPluginCommand.java:85)
              at hudson.cli.CLICommand.main(CLICommand.java:238)
              at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
      <clip>
      Caused by: java.io.FileNotFoundException: job-dsl (Is a directory)
      

      This also seems to result in an empty file created at /var/lib/jenkins/plugins, so the exception handling does not seem to be proper either.

      jenkins-cli.jar should obey the TMPDIR environment variable for temporary files, and default to /tmp if not set.

            Assignee:
            Unassigned
            Reporter:
            Heikki Hokkanen
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: