danielsollondon / azvmimagebuilder

Azure VM Image Builder
180 stars 153 forks source link

Azure VM Image Builder DevOps Task Quietly Fails with Space in Project Name #108

Closed wfschneider closed 7 months ago

wfschneider commented 3 years ago

My release pipeline is running manually in a project with spaces in the name. It runs for >70 minutes most times and sometimes succeeds and sometimes fails. When I load a VM instance my files are not present. When I check the log for a failure I notice the process actually completes after around 40 minutes but this failure is in the log.

A project with spaces in the name causes a failure to download artifacts. It seems like the task should properly escape with quotes to account for this.

Project Name: ‘My AIB PoC’ Message: azure-arm: Invoke-WebRequest : A positional parameter cannot be found that accepts argument ‘AIB’.

[fa695247-4b8e-4d4b-b3c3-956d0499a94a] PACKER ERR 2021/03/10 18:14:35 packer-provisioner-powershell plugin: Found command: Invoke-WebRequest -Uri 'https://vmimagebuild.blob.core.windows.net/imagebuilder-vststask/_My%20AIB%20PoC/9-1/_My%20AIB%20PoC_1615399740171.zip?[REDACTED] -OutFile c:\buildartifacts\_My AIB PoC.zip -UseBasicParsing
[fa695247-4b8e-4d4b-b3c3-956d0499a94a] PACKER ERR 2021/03/10 18:14:35 packer-provisioner-powershell plugin: Found command: Expand-Archive -Path c:\buildartifacts\_My AIB PoC.zip -DestinationPath c:\buildartifacts\_My AIB PoC
[fa695247-4b8e-4d4b-b3c3-956d0499a94a] PACKER OUT ==> azure-arm: Invoke-WebRequest : A positional parameter cannot be found that accepts argument 'AIB'.
[fa695247-4b8e-4d4b-b3c3-956d0499a94a] PACKER OUT ==> azure-arm: At C:\Windows\Temp\script-60490b7f-7915-6e62-13f3-db5dc024f804.ps1:2 char:1
[fa695247-4b8e-4d4b-b3c3-956d0499a94a] PACKER OUT ==> azure-arm: + Invoke-WebRequest -Uri 'https://vmimagebuild.blob.core.window ...
[fa695247-4b8e-4d4b-b3c3-956d0499a94a] PACKER OUT ==> azure-arm: + 

This should result in the immediate failure of the VM build.

wfschneider commented 3 years ago

I think I found the fix. In the Artifacts section of the Release Pipeline definition change the value of Source Alias replacing the spaces with dash/hyphen ('-'), then update the Build Path to use this new value. No more failures for that in the logs.

It still should have failed immediately IMO.

danielsollondon commented 7 months ago

Apologies @wfschneider and sorry for the delay in responding. @kof-f for awareness