lmars/packer-post-processor-vagrant-s3

Unknown artifact type, requires box from vagrant post-processor

robwilkerson opened this issue · 7 comments

This is most likely a me problem (I've used Packer for about a year, but am new to the S3 post processor), but having installed the S3 post processor and dropped in my template.json, I get an error that strikes me as odd. The .box file does get created.

My template.json:

"post-processors": [
  {
    "type": "vagrant",
    "output": "ct-drupal-dev.box"
  },
  {
    "type":     "vagrant-s3",
    "bucket":   "my-bucket",
    "manifest": "vagrant-boxes/manifest.json",
    "box_name": "ct-drupal-dev",
    "box_dir":  "vagrant-boxes",
    "version":  "1",
    "access_key": "MYKEY",
    "secret_key": "SUPERSECRET"
  }
],
...

The Packer output snippet:

==> virtualbox-iso: Running post-processor: vagrant
==> virtualbox-iso (vagrant): Creating Vagrant box for 'virtualbox' provider
    virtualbox-iso (vagrant): Copying from artifact: output-virtualbox-iso/ct-drupal-dev-disk1.vmdk
    virtualbox-iso (vagrant): Copying from artifact: output-virtualbox-iso/ct-drupal-dev.ovf
    virtualbox-iso (vagrant): Renaming the OVF to box.ovf...
    virtualbox-iso (vagrant): Compressing: Vagrantfile
    virtualbox-iso (vagrant): Compressing: box.ovf
    virtualbox-iso (vagrant): Compressing: ct-drupal-dev-disk1.vmdk
    virtualbox-iso (vagrant): Compressing: metadata.json
==> virtualbox-iso: Running post-processor: vagrant-s3
Build 'virtualbox-iso' errored: 1 error(s) occurred:

* Post-processor failed: Unknown artifact type, requires box from vagrant post-processor: mitchellh.virtualbox

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: 1 error(s) occurred:

* Post-processor failed: Unknown artifact type, requires box from vagrant post-processor: mitchellh.virtualbox

==> Builds finished but no artifacts were created.

Did I skip a step or miss something somewhere?

@robwilkerson to ensure vagrant-s3 runs after vagrant, you need to use a doubly nested array like:

{
  "post-processors": [
    [
      { "type": "vagrant" },
      { "type": "vagrant-s3" }
    ]
  ]
}

With just a single array they run in parallel.

Ah, crap. I read #1 and then still managed to misread my template.json. Thanks for the remedial version. :-)

@robwilkerson yeh its unexpected syntax and it had me stumped for a while.

I actually never got this plugin to work for large files (#2) and had to fall back to using s3cmd, let me know if it works for you.

I'm not sure how large a file you were trying to upload, but this seems to have worked great for my 1.14GB box. The only thing I didn't expect, and I'll have to go back over the configuration options, is that instead of storing the file as my-bucket/vagrant-boxes/ct-drupal-dev.box, it created a folder for the version and stored my-bucket/vagrant-boxes/1/ct-drupal-dev.box. I understand why that could be intentional, I just didn't notice it indicated in the README. Will re-read in case I missed it.

@robwilkerson ok great! Maybe I was just having network issues then.

I added the version to the path on purpose so that if you don't have the version in your box name, you will not override previous versions of the box. I don't think I put that in the README though...

No. I was actually thinking of forking the project and making a few readme updates based on my experience if you don't have any issue with that.

@robwilkerson sure that would be great!