Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable vsphere-template post processor to work with local builders #5380

Merged
merged 10 commits into from Feb 9, 2018

Conversation

bugbuilder
Copy link

Takes an artifact from the vsphere post-processor and allows to use the vsphere-template with it.

Closes #5354

@mwhooker
Copy link
Contributor

This looks good to me. I saw in #5354 that there's some real world usage of this.

I will target this for a future release and solicit comments until then. Unfortunately I'm not well versed enough in vsphere to really understand the implications of this, so will rely on the community to voice their opinions.

Thanks for the work!

@lawrence-c
Copy link

This would be awesome to have, as I'm currently using the VSphere SDKs to do the next post processing step of marking a VM as a template after uploading using the VSphere template - and having everything done with Packer instead would be very nice instead of maintaining custom scripts.

@bugbuilder bugbuilder requested a review from a team as a code owner November 10, 2017 17:03
@bugbuilder
Copy link
Author

@jonmosco Could you test this again? I did few changes, in this moment I've troubles with my local environment, your feedback will help me a lot.

@jonmosco
Copy link

Yes, for sure. Are all the commits in the repo I was testing against previously ?

@bugbuilder
Copy link
Author

Yes, same repo.

@jonmosco
Copy link

Ok, it did not complete successfully. Same packer template, and after building, this is the packer version being used:

Packer v1.1.2-dev

==> vmware-iso: Running post-processor: vsphere-template
2017/11/10 12:53:29 [INFO] (telemetry) ending vsphere-template
2017/11/10 12:53:29 [INFO] (telemetry) found error: Unknown artifact type, can't build box:
2017/11/10 12:53:29 Deleting original artifact for build 'vmware-iso'
2017/11/10 12:53:31 ui error: Build 'vmware-iso' errored: 1 error(s) occurred:

  • Post-processor failed: Unknown artifact type, can't build box:
    2017/11/10 12:53:31 Builds completed. Waiting on interrupt barrier...
    2017/11/10 12:53:31 machine readable: error-count []string{"1"}
    2017/11/10 12:53:31 ui error:
    ==> Some builds didn't complete successfully and had errors:
    2017/11/10 12:53:31 machine readable: vmware-iso,error []string{"1 error(s) occurred:\n\n* Post-processor failed: Unknown artifact type, can't build box: "}
    Build 'vmware-iso' errored: 1 error(s) occurred:

  • Post-processor failed: Unknown artifact type, can't build box:

==> Some builds didn't complete successfully and had errors:
2017/11/10 12:53:31 ui error: --> vmware-iso: 1 error(s) occurred:

  • Post-processor failed: Unknown artifact type, can't build box:
    2017/11/10 12:53:31 ui:
    ==> Builds finished but no artifacts were created.
    2017/11/10 12:53:31 [INFO] (telemetry) Finalizing.
    --> vmware-iso: 1 error(s) occurred:

  • Post-processor failed: Unknown artifact type, can't build box:

==> Builds finished but no artifacts were created.
2017/11/10 12:53:31 waiting for all plugin processes to complete...

@bugbuilder
Copy link
Author

@jonmosco Thanks!! It was helpful. Could you try again?

@jonmosco
Copy link

Looks good:

==> vmware-iso: Running post-processor: vsphere-template
vmware-iso (vsphere-template): Waiting 10s for VMware vSphere to start
vmware-iso (vsphere-template): Choosing datacenter...
vmware-iso (vsphere-template): Creating or checking destination folders...
vmware-iso (vsphere-template): Marking as a template...
Build 'vmware-iso' finished.

@bugbuilder
Copy link
Author

@f-roscher just to be clear about which version was compiled:

using docker

1. mkdir -p new-foder && cd new-foder
2. git clone https://github.com/bennu/packer.git
3. cd packer
4. git checkout local-vsphere-template 
5. docker run --rm -v $(pwd):/go/src/github.com/hashicorp/packer -w /go/src/github.com/hashicorp/packer -e GOARCH=amd64 -e GOOS=linux -e CGO_ENABLED=0 golang:1.8.3-alpine go build -o bin/packer

using fork directly

1. go get github.com/hashicorp/packer
2. cd $GOPATH/src/github.com/hashicorp/packer/
3. git remote add bennu https://github.com/bennu/packer.git
4. git fetch bennu
5. git checkout local-vsphere-template  
6. go build -o bin/packer .

Also I would like know your workstation or player version.

@bugbuilder
Copy link
Author

@f-roscher Could you try again? I'll glad to help you.

@f-roscher
Copy link

@bugbuilder @jonmosco, thanks for your help. In fact I had not been using a current build from the checked out branch when I got the error. The error message has vanished now.
Sorry for not replying promptly - I intended to reply when I am finished with my setup, but this might have to wait until Thursday. Right now I seem to have troubles with my intended result of VM template inside a subfolder an keeping it registered as a template. But I will double check and come back to you respective back here.

@f-roscher
Copy link

@bugbuilder I don't have any success with the target folder. The output says:
==> Builds finished. The artifacts of successful builds are:
--> vmware-iso: VM: packer-vm-template Folder: template/ Datastore: fc_int_inf_vm_lt_LUN103

But the VM-Template ends up within the top folder of the respective datacenter.

@bugbuilder
Copy link
Author

Could you share your template, log, vSphere version and workstation version please.

@bugbuilder
Copy link
Author

@f-roscher your feedback is welcome.

@f-roscher
Copy link

@bugbuilder
Copy link
Author

@f-roscher Thanks. I'll take a look this week.

@bugbuilder
Copy link
Author

@f-roscher to understand your problem, yoy said

But the VM-Template ends up within the top folder of the respective datacenter.

But I saw your template and I didn't see the option "folder": "/packer-templates/os/distro-7". If is that your problem you only need to add the folder path where you want your template.

Please let me know if I understand your problem.

@bugbuilder
Copy link
Author

@f-roscher I think that you want that the vsphere-template post-processor use the folder from the vsphere post-processor, that's the bug, correct?

@f-roscher
Copy link

@bugbuilder : I am no longer sure if I would classify the current behaviour as a bug. Based on my interpretation of older discussion on this pull request and related branches and issues on Github I tought, the option 'vm_folder' of postprocessor 'vsphere' would define the folder to put the template into in the end. This assumption seems to be false. I will retry with different settings including the option 'folder' on the postprocessor 'vsphere-template'.

@bugbuilder
Copy link
Author

Hi @f-roscher I'm think the same it's not a issue or bug, in the future both post-processor needs to be merge.
Let me know if you new settings works.

Copy link
Contributor

@SwampDragons SwampDragons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this change!

@ghost
Copy link

ghost commented Mar 31, 2020

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.

@hashicorp hashicorp locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: vsphere-template post processor to work with local builders
6 participants