hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.11k stars 3.33k forks source link

PostProcessor does not respect PackerConfig.PackerForce #10536

Closed tduffield closed 3 years ago

tduffield commented 3 years ago

Overview of the Issue

I am working on adding a post-processor to a custom plugin that works with Veertu Anka. The custom plugin contains a builder (to build the VM) and a post-processor (to upload the VM to a registry) The issue I'm running into is that while the builder config seems to respect the -force flag, the post-processor does not.

Reproduction Steps

  1. Install Anka Develop
  2. Install packer 1.7 nightly
  3. Build/install the 089a00b87a5f23cf271c098e6bbe73d555aa9a9e commit of the packer-builder-veertu-anka plugin.
  4. Execute build with PACKER_LOG=1

Packer version

1.7.0-dev [go1.15.7 darwin amd64]

Simplified Packer Buildfile

source "veertu-anka-vm" "core-10_15" {
  vm_name = "10.15-core"
  installer_app = "/Applications/Install macOS Catalina.app"
}

build {
  name = "core"

  sources = [
    "source.veertu-anka-vm.core-10_15",
  ]

  post-processor "veertu-anka-registry" {
    tag = "latest"
  }
}

Operating system and Environment details

Running on MacOS 10.5.7.

Log Fragments and crash.log files

Full Gist Output

You'll notice that I output the Config value twice: once for the builder and again for the post-processor.

nywilken commented 3 years ago

Hi there @tduffield thanks for reaching out. We're excited to hear about the custom builder you are working on. We just updated issue #8610 pertaining to an improve plugin experience we are working on for v1.7.0 that will be helpful to you https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737

Regarding your original issue around the force flag not being honored by your Post-Processor. I need to dive a little deeper to see if we have support for the force flag in HCL2 for provisioners and post-processors. As a quick glance it seems like we might be missing it.

If you run your build using a JSON configuration does the post-processor honor the force flag?

tduffield commented 3 years ago

@nywilken Thanks for the reference to that issue; I'll have to check it out.

I was able to confirm that the post-processor does support the PackerForce flag when used with JSON configuration.

ghost commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.