microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.43k stars 2.59k forks source link

ARM Deployment Task - Error when spaces in template path for bicep files #16789

Open GMedlin opened 1 year ago

GMedlin commented 1 year ago

Note

Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo

For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

If you have an issue or request for the Azure Pipelines service, use developer community instead:

https://developercommunity.visualstudio.com/spaces/21/index.html )

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: ARM template deployment

list here (V# not needed):
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/AzureResourceManagerTemplateDeploymentV3

Environment

Issue Description

ARM Template deployment fails for bicep files when the path includes spaces. The same task succeeds for an ARM template json file. I've tried enclosing the Template file path argument in single quotes, double quotes, and using a variable for it. I am currently using an Azure PowerShell task instead as a workaround using New-AzResourceGroupDeployment.

Task logs

ReleaseLogs_170.zip

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs

tasklog_6.log

Eonasdan commented 1 year ago

I just came across this issue as well. What's a timeframe for fixing this?

jerchap commented 1 year ago

My workaround for the time being was to change the source artifact name in my release pipeline, as this is where the spaces where occurring, because of the git repo name.

trolleyboy commented 1 year ago

Also seeing this issue (finally getting around to playing with Bicep). Error: Command failed: az bicep build --file <path to file> Seems Az CLI isn't passed the file path wrapped in quotes. I'd guess something here needs a tweak: https://github.com/microsoft/azure-pipelines-tasks/blob/65a9f6e8d367eff31d6e50ad871e0fd62aa6c541/Tasks/AzureResourceManagerTemplateDeploymentV3/operations/Utils.ts#L461

GMedlin commented 1 year ago

I've just continued to use the Azure PowerShell task and the New-AzResourceGroupDeployment cmdlet rather than the ARM Template Deployment task.

fmms commented 1 year ago

found the same issue today. It is quiet hard to understand because the AzureResourceManagerTemplateDeployment@3 finds the file. Only the internal call the fails:

##[error]Error: Command failed: az bicep build --file /home/vsts/work/1/s/90 Deployment/platform.bicep
ERROR: unrecognized arguments: Deployment/platform.bicep
DaleyKD commented 1 year ago

+1, please. Everything was working fine when I used a JSON ARM Template. Decided to try Bicep today and everything blew up.

Eonasdan commented 1 year ago

@DaleyKD if you're just getting into ARM conversion, I'd suggest you look at Pulumi or the Terraform CDK. It will take some effort to learn but blows bicep out of the water.

github-actions[bot] commented 6 months ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

fmms commented 6 months ago

This tasks is still relevant it even has a PR… #19382

StevenDevooght commented 5 months ago

This issue is still present when using the AzureResourceManagerTemplateDeployment@3 YAML task...

venkymanda commented 4 months ago

Yeah , its an issue I hope MS team will fix by merging my PR .

PolkageistHS commented 1 month ago

Yeah , its an issue I hope MS team will fix by merging my PR .

@venkymanda Looks like your PR has a merge conflict. Any chance you can fix it so it can get pushed? Would like this to get fixed so I can use the task instead of powershell gimmicks

thommaa commented 2 weeks ago

Updated PR existing here with test cases implemented https://github.com/microsoft/azure-pipelines-tasks/pull/20048