rgl / packer-plugin-windows-update

Packer plugin for installing Windows updates
Mozilla Public License 2.0
299 stars 71 forks source link

Issue with VSTS Azure DevOps Pipeline and Packer 1.7.2 #97

Closed zkhcohen closed 3 years ago

zkhcohen commented 3 years ago

Hey.

I receive the following issue when attempting to use this Packer Provisioner with Packer 1.7.2 installed to a VSTS Azure Devops Pipeline via Chocolatey...

Initial spin-up of validation stage where it discovers the internal plugin:

2021/07/02 00:25:57 [INFO] Packer version: 1.7.2 [go1.16.3 windows amd64]
2021/07/02 00:25:57 [TRACE] discovering plugins in C:\ProgramData\Chocolatey\lib\packer\tools
2021/07/02 00:25:57 [TRACE] discovering plugins in C:\Users\VssAdministrator\AppData\Roaming\packer.d\plugins
2021/07/02 00:25:57 [DEBUG] Discovered plugin: windows-update = C:\Users\VssAdministrator\AppData\Roaming\packer.d\plugins\packer-provisioner-windows-update.exe
2021/07/02 00:25:57 using external provisioners [windows-update]
2021/07/02 00:25:57 [TRACE] discovering plugins in .
2021/07/02 00:25:57 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/07/02 00:25:57 [INFO] PACKER_CONFIG env var set; attempting to open config file: C:\Users\VssAdministrator\AppData\Roaming\packer.config
2021/07/02 00:25:57 [WARN] Config file doesn't exist: C:\Users\VssAdministrator\AppData\Roaming\packer.config
2021/07/02 00:25:57 [INFO] Setting cache directory: D:\a\1\s\packer_cache

The specific failure point:

2021/07/02 00:25:58 Starting plugin: C:\Users\VssAdministrator\AppData\Roaming\packer.d\plugins\packer-provisioner-windows-update.exe []string{"C:\\Users\\VssAdministrator\\AppData\\Roaming\\packer.d\\plugins\\packer-provisioner-windows-update.exe"}
2021/07/02 00:25:58 Waiting for RPC address for: C:\Users\VssAdministrator\AppData\Roaming\packer.d\plugins\packer-provisioner-windows-update.exe
2021/07/02 00:25:58 packer-provisioner-windows-update.exe plugin: 2021/07/02 00:25:58 **Starting packer-plugin-windows-update (version 0.12.0; commit ed5cb10b6e5857c4d85747ca4aa43f07ef30c727; date 2021-04-18T21:07:09Z)**
2021/07/02 00:25:58 packer-provisioner-windows-update.exe plugin: 2021/07/02 00:25:58 **Failed to start: needs at least one argument**
2021/07/02 00:25:58 C:\Users\VssAdministrator\AppData\Roaming\packer.d\plugins\packer-provisioner-windows-update.exe: plugin process exited

error initializing provisioner 'windows-update': plugin exited before we could
connect

It's worth noting that I'm simply copying the plugin .exe file to the path: C:\Users\VssAdministrator\AppData\Roaming\packer.d\plugins

Copying it next to the packer.exe (C:\ProgramData\Chocolatey\bin\packer.exe) results in a failure to detect the plugin, despite: 2021/07/02 00:25:57 [TRACE] discovering plugins in .

Any ideas what the issue could be?

rgl commented 3 years ago

Never tried it like that. You could try running in your machine and/or install it with packer init instead.

zkhcohen commented 3 years ago

Never tried it like that. You could try running in your machine and/or install it with packer init instead.

Switching from the built-in Packer extension to the riezebosch version, and using Packer init resolved the issue!

Thanks.

rgl commented 3 years ago

What is the riezebosch version?

zkhcohen commented 3 years ago

What is the riezebosch version?

https://marketplace.visualstudio.com/items?itemName=riezebosch.Packer

rgl commented 3 years ago

Interesting. I never really used Azure DevOps. That seems to be equivalent to the packer github actions.

Is there any particular reason for using Azure DevOps over GitHub Actions?

To create the Virtual Machines are you using https://www.packer.io/docs/builders/azure/arm?

zkhcohen commented 3 years ago

Is there any particular reason for using Azure DevOps over GitHub Actions?

We use Azure DevOps to integrate with our hybrid cloud environment, not GitHub. On-premise, I'm hosting this in Docker to integrate with VMWare clusters.

To create the Virtual Machines are you using https://www.packer.io/docs/builders/azure/arm?

ARM is utilized for the provisioning of the temporary VMs during the image build process, but the final VMs created out of the golden image are deployed using Terraform.

rgl commented 3 years ago

On-premise, I'm hosting this in Docker to integrate with VMWare clusters.

What do you mean by "hosting in docker"? Can you explain what is the relation between docker, golden image, and a VMware VM? And what is the flow between those? :-)

zkhcohen commented 3 years ago

What do you mean by "hosting in docker"? Can you explain what is the relation between docker, golden image, and a VMware VM? And what is the flow between those? :-)

Packer is containerized in Docker. Running the Packer build generates a 'golden image' of Windows Server which is deployed to a VMware ESXi cluster.

Check out the builders here: https://www.packer.io/docs/builders/vmware

rgl commented 3 years ago

I see, I now understand what you mean by hosted in docker. What is being hosted is packer and you build it from there.