microsoft / azure-pipelines-tasks

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

Select multiple files in template field using wildcard #10388

Closed jonsnowax closed 3 years ago

jonsnowax commented 5 years ago

How can i select multiple JSON file containing specific text within its name in the Template field. Basically i have requirements to deploy multiple JSON files through this task. I tried using wildcard but its not able to find files. For example the in template field I entered: *_Apps.json

So it should return all the files ending with this format from Linked artifacts but it is not.

damccorm commented 5 years ago

Which task are you asking about? Looks like maybe one of the download artifacts tasks?

jonsnowax commented 5 years ago

I am asking about "Azure resource group deployment" task. It basically deploys JSON file. I want to deploy multiple JSON files (with specific name e.g. _Cantemplate.json) placed under different folders in Linked Artifacts.

jalajmsft commented 5 years ago

Azure resource group deployment task currently support single template file deployment only. We would like to understand your scenario in more detail - does this JSONs deploy independently one after another or are they linked among themselves? You can read more about linked templates here

jonsnowax commented 5 years ago

LinkedArtifacts_ReleasePipeline

As you can see in the image, I have LinkedArtifact in release pipeline and it contains multiple LogicApps projects. The number of projects can go up to 50. In each project i have LogicApp.json file which is the main Logic Apps file. I want these LogicApp.json files (under each projects) to be deployed automatically to specified resource groups in the "Azure resource group deployment task".

Currently i am trying to give pattern in "template file" (as you can see in image) TemplateFile

But its not returning any file and throwing error during release operation that "Couldn't find matching file".

Please let me know what should i do to deploy all logic apps naming "LogicApp.json" through a single Azure resource group deployment task. These are not dependent and need to be deployed independently of each other.

Any help would be appreciated.

Thanks

jalajmsft commented 5 years ago

Azure resource group deployment task currently expects only a single file path for template - the path can be a specific path or a pattern. Are all the logic apps supposed to be deployed in a single resource group or separate?

Alternatively you can checkout Azure CLI task here, where you can deploy via script.

jonsnowax commented 5 years ago

Thank you for your response.

Initially all will be deployed to single resource group.

Later on, we may need to deploy to UAT or Prod resource group.

jalajmsft commented 5 years ago

To deploy multiple templates you will have to use the task multiple times. Alternatively you can checkout Azure CLI task here, where you can deploy via script in a single task. Adding @pulkitaggarwl

pulkitaggarwl commented 5 years ago

@jonsnowax Thanks for raising the issue. Adding the request to the backlog.

jonsnowax commented 5 years ago

@jalajmsft Please can you demonstrate how can I use Azure CLI to automate deployment of multiple logic apps ?

I need a walkthrough for this.

Thanks

jalajmsft commented 5 years ago

@jonsnowax There are multiple ways, one of them could be to write a script to loop through all the folder containing the template file and use the following command to deploy - az group deployment create --resource-group <resource-group-name> --template-file <path-to-template>.

You can view various approach to deploy template via Azure CLI here.

Alternatively have a look at this to deploy using Azure PowerShell.

jonsnowax commented 5 years ago

How can write script. Please an you send sample script which loops through Linked artifacts folder and find specific logic app file and parameter file.

jalajmsft commented 5 years ago

You can write a script in batch or powershell to loop the Linked artifacts folder and find specific logic app file and parameter file. Additionally use Azure CLI within the script for ARM template deployment.

Hope this helps. Thanks.

github-actions[bot] commented 3 years 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

tdaugaard commented 3 years ago

This is exactly what I was looking for now, and I'm sad to see that it isn't looking to be implemented soon. My use case i public DNS zones in Azure, for which it doesn't make sense to create a release pipeline for each zone, of which we have 124 at the moment.

Is there any easy way to handle that? Using nested templates doesn't allow for using "Complete" deployment mode, which is desirable with DNS to ensure only records that are in the template exists.