• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • packer-plugin
    • None
    • Jenkins 1.598, packer plugin 1.0

      I've run into a problem using packer-plugin when the json I'm trying to use is in a subdirectory.

      For example, my Jenkins job is cloning a git repo containing various packer configurations (e.g. centos-6.5, rhel-6.5, etc.). Each one is in a separate folder and has a template.json and a scripts directory.
      Under the Packer post-build actions I specify Packer Template File "centos-6.5/template.json".
      When I run the job I get the following error:

      [workspace] $ /var/lib/jenkins/tools/biz.neustar.jenkins.plugins.packer.PackerInstallation/packer-0.7.5/packer build -only=virtualbox-iso -debug "/var/lib/jenkins/jobs/Packer build/workspace/centos-6.5/template.json"

      4 error(s) occurred:

      • Bad script 'scripts/base.sh': stat scripts/base.sh: no such file or directory
      • Bad script 'scripts/vagrant.sh': stat scripts/vagrant.sh: no such file or directory
      • Bad script 'scripts/virtualbox.sh': stat scripts/virtualbox.sh: no such file or directory
      • Bad script 'scripts/cleanup.sh': stat scripts/cleanup.sh: no such file or directory

      It appears that the relative paths (such as scripts/base.sh) in template.json are expected to be in the current directory (which is workspace/) although I'm calling workspace/centos-6.5/template.json.
      So when I changed the script paths in the json to be "centos-6.5/scripts/base.sh" it ran successfully, however, I don't want to do that as it breaks the script if I then try to run it from within centos-6.5 (which is the recommended way).

      It would be great to have a "Change directory" parameter for packer-plugin to change the working directory before calling packer.

          [JENKINS-26966] Unable to build packer image from subdirectory

          Code changed in jenkins
          User: jdamick
          Path:
          src/main/java/biz/neustar/jenkins/plugins/packer/PackerPublisher.java
          src/main/resources/biz/neustar/jenkins/plugins/packer/PackerPublisher/config.jelly
          src/main/resources/biz/neustar/jenkins/plugins/packer/PackerPublisher/help-changeDir.html
          src/test/java/biz/neustar/jenkins/plugins/packer/PackerJenkinsPluginTest.java
          http://jenkins-ci.org/commit/packer-plugin/f4b8505e8788f8a591be9b56aaa90644d55aae03
          Log:
          added support for JENKINS-26966

          Compare: https://github.com/jenkinsci/packer-plugin/compare/40df245682b2...f4b8505e8788

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: jdamick Path: src/main/java/biz/neustar/jenkins/plugins/packer/PackerPublisher.java src/main/resources/biz/neustar/jenkins/plugins/packer/PackerPublisher/config.jelly src/main/resources/biz/neustar/jenkins/plugins/packer/PackerPublisher/help-changeDir.html src/test/java/biz/neustar/jenkins/plugins/packer/PackerJenkinsPluginTest.java http://jenkins-ci.org/commit/packer-plugin/f4b8505e8788f8a591be9b56aaa90644d55aae03 Log: added support for JENKINS-26966 Compare: https://github.com/jenkinsci/packer-plugin/compare/40df245682b2...f4b8505e8788

          Jeffrey Damick added a comment - - edited

          added in 1.2

          Jeffrey Damick added a comment - - edited added in 1.2

          Jeffrey Damick added a comment - - edited

          fixed in 1.2

          Jeffrey Damick added a comment - - edited fixed in 1.2

            jdamick Jeffrey Damick
            tenyo Tenyo Grozev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: