azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

Overridable commands i.e., shell-script provider

Open atrakic opened this issue 3 years ago • 8 comments

Please allow shell-scripts in provider list

atrakic avatar Nov 04 '22 17:11 atrakic

@atrakic can you add some more details on,

  • Use-case for the same and how were you envisioning it to be used.
  • Which azd commands/operations you would want that provider to act-on.

rajeshkamal5050 avatar Nov 04 '22 19:11 rajeshkamal5050

@atrakic can you add some more details on,

  • Use-case for the same and how were you envisioning it to be used.
  • Which azd commands/operations you would want that provider to act-on.

I have this example repo that follows azd template file structure: https://github.com/atrakic/azure-webapp-deploy. Instead of using bicep/tf providers, I would like acd to create infra, build and deploy image. Please advise. Thx

atrakic avatar Nov 04 '22 22:11 atrakic

Can you give an example of what would be in the script? az cli commands?

jongio avatar Nov 08 '22 22:11 jongio

@jongio Within the repo I have already mentioned, I have already script with az commands for creating a web app with linux container: https://github.com/atrakic/azure-webapp-deploy/blob/main/infra/setup.sh. Does this answers your question?

atrakic avatar Nov 10 '22 19:11 atrakic

IC, We could potentially support this with #810 ext @wbreza is that right?

I'm curious though why you prefer to do that over bicep or terraform. With your approach you have no tear down support and it gets cumbersome to maintain. Highly recommend going iac route.

I also noticed that you have .go in your /src folder. azd doesn't yet support go apps either. @rajeshkamal5050 FYI

jongio avatar Nov 10 '22 22:11 jongio

@jongio

IMHO, I find az cli as cleanest, lightest, easy to follow route to create infra resources without installing extra libs, sdks, etc, so Im really interested in having this feature buildt in acd.

Also, as per tear down: you have a point there, but this can be solved by exporting command instructions (after infra deployment) in tmp file which can be used for later destroy phase - aka terraform local state. What do you think about this?

I was not aware of go apps are not supported, thx for letting me know. Any plans for the future?

atrakic avatar Nov 11 '22 16:11 atrakic

May be another extensibility use-case for script-based provisioning. How to leverage existing scripts (invokes Az CLI commands, direct REST API's etc.) for provisioning i.e., not using IaC(Bicep, Terraform). The pre and post hooks assume the provisioning is done via our IaC(Bicep/Terraform).

rajeshkamal5050 avatar Nov 11 '22 16:11 rajeshkamal5050

I have also thought about this. Having script support for IaC providers would also support transitional scenarios where a team may have existing legacy script based deployment system with plans to migrate to bicep/terraform.

I could see this going one of 2 ways.

  • New script based IaC provider where the dev would need to provide the up and down scripts
  • Azd extensibility route where you dev overrides the whole provision / infra create command with a custom script

I believe the latter would be more extensible scenario and solve additional use cases.

wbreza avatar Nov 11 '22 17:11 wbreza