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.08k stars 3.33k forks source link

flag to skip postprocessor #2679

Closed rrva closed 5 years ago

rrva commented 9 years ago

I'd like a flag to skip certain postprocessors, for example atlas when I only want to do a local build.

rrva commented 9 years ago

Similar to -only:

packer -postprocessors vagrant

will only run the vagrant postprocessor

ghost commented 9 years ago

2nd this. I know docker really wants us to use dockerhub but I don't have any need for that.

robertrossmann commented 9 years ago

:+1:

Yes, this would be a welcome addition. I frequently find myself testing my builds locally to catch any errors before I am ready for publishing and so far I had to manually remove the atlas post-processor when I wanted to only do a local build.

mwrock commented 9 years ago

:+1: yes. this would be a welcome feature

simbo commented 9 years ago

+1 Yes, please.

mvermaes commented 9 years ago

:+1:

Currently we maintain two templates, one to generate AWS/Vagrant images via Atlas, another with the details required for the vSphere postprocessor (which is otherwise identical to the Atlas one).

sharumpe commented 8 years ago

+1

We also maintain two .json files: one for vagrant box build for testing and one for vSphere. It would be wonderful to be able to overload -only= or add -only-post= (or similar) to limit the post-processor.

bdwyertech commented 8 years ago

:+1:

wyaeld commented 8 years ago

@cbednarski any love for this? Seems consistent with the DRY design.

Only comment I would make it that potentially rather than referring to provisioners/builders/post-processors by type, being able to 'tag' them, and filter the tags to run would give more flexibility, and its a pattern used successfully in some other tools.

eg.

packer build -tags vmware my-packer-template-with-everything.json

packer build --help
...
Options:

  -tags=foo,bar,baz         Only include the builds, provisioners and post-processors that match the tags
...
cbednarski commented 8 years ago

Thanks for the suggestion, folks. This sounds like a good feature addition to me, but it's not on my short list right now.

rather than referring to provisioners/builders/post-processors by type, being able to 'tag' them, and filter the tags to run would give more flexibility

I like this idea. At least from a UX perspective this is a nice way to do things since you won't need to remember a bunch of different flags. At first glance I think we may be able to overload -only to use tags or builds. By default nothing will have a tag (and tags will not exist in anyone's build templates) so it should be backwards-compatible. Need to consider some of the compound cases here before committing to this, though.

steve-jansen commented 8 years ago

Ran into this problem with local packer builds that include an Atlas post-processor.

As a one-liner workaround, the awesome jq can strip the post-processor block, then pipe it via stdin to packer...

jq 'del(."post-processors")' packer.json | packer build -
bdwyertech commented 8 years ago

Thank you sir @steve-jansen, didn't know jq existed. Great addition to the arsenal.

bdwyertech commented 8 years ago

It seems stripping post-processors caused no build artifacts to be produced, not even a local box. If you want to target a specific post-processor, use this jq '.["post-processors"][0] |= map(select(.type != "atlas"))' packer.json | packer build -

Credit goes to @parkershepherd

marcusportmann commented 8 years ago

+1

Also struggling with local packer builds that include an Atlas post-processor.

panpan0000 commented 7 years ago

+1

pierreant-p commented 7 years ago

+1

rverchere commented 7 years ago

+1

awiddersheim commented 7 years ago

+1

lfarnell commented 7 years ago

please don't +1 in a comment. Please use a reaction stead. It generates unnecessary emails when a +1 comment is made

ghost commented 4 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.