Hello there,
I would like to see a download
command added to packer to only download and check the ISO file without starting to build anything. The idea behind this feature request would be to be able to automatically (using a CI service for example) check if the ISO file used by a template is still available (to avoid dead links).
I look forward to your feedback on this feature.
Cheers.
I like this idea and I don't think it's the first time someone has asked for it. I think I've also seen people suggest adding an option to the null builder to allow it to download ISOs. Definitely worth thinking about and seeing if we can add it to the roadmap.
I think download
is not a clear name for such command. I'd extend this feature request to all builders which has any kind of base of source image. For example, amazon-ebs
builder has source_ami
parameter and proposed command may validate that image exists. Similar thing can be done with other builders. Also, in most cases there is no sense to download full image and it is enough to issue HEAD http request to check that link is not broken.
I think this functionality may be introduced as part of the validate
command using additional flag.
@SwampDragons, what do you think?
Historically, we've found that expecting network access for the validate command often breaks peoples' pipelines. The idea of adding these network checks behind a flag inside validate is a good one.
i'm propose not use download keyword, but something like cache.
so all remote resources must be cache inside packer_cache dir for feature use
I agree with @vtolstov here, I'm also copy pasting a comment I made before there : https://github.com/hashicorp/packer/issues/7132#issuecomment-448622015
I like the idea of
packer build -cache buildfile
because changes would be minimal IMO. We would just have to pass a boolean to StepDownload:Say:
StopAfterCompletion: true
orStopAfterCompletion: b.config.Cache
which can halt packer execution afterStepDownload.Run
executed successfully.
@azr your approach will works only for builders that using downloadable artifacts. But what about other cloud builders like EC2?
I don't think that adding feature which works only for small amount of builders is good approach.
@bronislav, packer doesn't really have a state of built EC2 instances and I _think_ caching shouldn't apply here. To do so we would have to start an instance, download stuff to it; then save it then _remember_ the AMI. To me; this is already 2 different buildfiles.
But may be I am missing something and if so please elaborate on what you had in mind. 馃檪
@azr I mean that to build AMI using EC2 builder packer don't need to download anything. Instead it could check using AWS API that the base AMI it is going to use actually exists. Some other builder may use different approach.
Right, I should have read the previous messages, sorry.
I also like the idea to sorts of "validate pre conditions".
But I think this would require adding a step after validation.
Most helpful comment
Historically, we've found that expecting network access for the validate command often breaks peoples' pipelines. The idea of adding these network checks behind a flag inside validate is a good one.