Packer: --only skips post processors despite docs saying otherwise

Created on 31 Jan 2019  ·  7Comments  ·  Source: hashicorp/packer

From the docs :

-only=foo,bar,baz - Only run the builds with the given comma-separated names. Build names by default are their type, unless a specific name attribute is specified within the configuration. -only does not apply to post-processors

packer 1.3.4
amd64

Test via
PACKER_LOG=1 packer build --var-file=foo.json --only=gcp packer-test.json

core regression

Most helpful comment

So from #7262, that also updates our tests, here are a set of binaries. Please tell me if that fixes it for you:

packer_darwin_amd64.zip
packer_linux_amd64.zip
packer_windows_amd64.zip

I wanted to reuse functions, but shouldn't have !

All 7 comments

Thanks for opening! We'll get on this ASAP.

looks like a regression from https://github.com/hashicorp/packer/pull/7183/files
from a quick glance, it looked like func (o *OnlyExcept) Skip is probably not the right function to call, since it filters on only, which is not supposed to be applicable to post-processors

I feel like we're impacted by this also. We're seeing that post-processors no longer execute if only is specified on the post-processor config and matches the builder name. When we use -only on the cli, the post-processor is skipped.

From the issue report, it _appears_ there is a new name key for post-processors, and if we set that to match the builder name, then it will work as expected? How do we make it work if there are multiple builders that should match a single post-processor?

Also, this name key is not mentioned in the docs, and the docs appear to contradict this idea of using a name for post-processors to filter only/except: https://www.packer.io/docs/templates/post-processors.html

The values within only or except are build names, not builder types. If you recall, build names by default are just their builder type, but if you specify a custom name parameter, then you should use that as the value instead of the type.

(Sidenote: Any idea why this new feature went into a bug release?)

Apologies, that one is on me, too new to packer, I tested with the -only option, but was not aware/did not pay enough attention to the only option inside the schema of a post-processor. I'll fix this as soon as possible.

So from #7262, that also updates our tests, here are a set of binaries. Please tell me if that fixes it for you:

packer_darwin_amd64.zip
packer_linux_amd64.zip
packer_windows_amd64.zip

I wanted to reuse functions, but shouldn't have !

Thanks @azr, those binaries appear to be working as expected again! 💯

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.

Was this page helpful?
0 / 5 - 0 ratings