Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azd init should also create infra, CICD: .github/workflows or .azdo/pipelines folders #135

Closed
jongio opened this issue Jul 18, 2022 · 18 comments · Fixed by #2055
Closed

Comments

@jongio
Copy link
Member

jongio commented Jul 18, 2022

Right now azd init creates .azure, .gitignore, and azure.yaml.

It should also create a /infra folder with main.bicep, resources.bicep, and main.parameters.json.

@rajeshkamal5050 rajeshkamal5050 added this to the Next milestone Jul 18, 2022
@ellismg
Copy link
Member

ellismg commented Jul 19, 2022

What will we put in these files and why? Why wouldn't a user use --template in this case? I think we should be minimizing the number of files that are created with init especially in cases where you aren't using a template.

@jongio
Copy link
Member Author

jongio commented Jul 19, 2022

This will help when azdev-ifying a template. We expect the /infra folder to have the files mentioned above, we should have the placeholder files with the required name, location, parameters and env var replacements. Otherwise the azd-ify expereince will always include a step to copy those files to the infra folder.

@puicchan
Copy link
Contributor

We should consider having a new command for azdev-ify a new or existing project, like azd create.

  • I have tried azdev-ify a few templates and had to manually add the same applicationinsights.bicep file. We can provide an option to pull the applicationinsights.bicep from an azd template.
  • Also, for azd pipeline config, I had to manually add .github/workflow; copy and paste the same azure-dev.yml file from an azd template.

@Gordonby
Copy link

passing a switch to azd init for a full scaffold might be a good idea then 😉

azd init --full-scaffold

@spboyer
Copy link
Member

spboyer commented Jul 26, 2022

azd init new

@jongio
Copy link
Member Author

jongio commented Jul 27, 2022

Let's use this opportunity to discuss scenarios/workflows for azdevifying applications. @puicchan - Do we have a work item to track that? If not could you start one? We can close this issue in favor of an uber azdevify issue.

@rajeshkamal5050 rajeshkamal5050 modified the milestones: Release 0.2, On Deck Aug 4, 2022
@rajeshkamal5050 rajeshkamal5050 modified the milestones: On Deck, Backlog Oct 4, 2022
@puicchan puicchan changed the title azd init should also create infra folder azd init should also create infra, CICD: .github/workflows or .azdo/pipelines folders Jan 4, 2023
@rajeshkamal5050 rajeshkamal5050 modified the milestones: Backlog, Release 0.7 Feb 6, 2023
@weikanglim
Copy link
Contributor

@jongio @puicchan @savannahostrowski

I'd like to separate this issue out from azdevifying (covered by App fingerprint #705). In that flow, we will generate azure.yaml with all projects scanned from existing code, and infra folder from an existing template.

However, I'd like to use this issue to fix the user journey of azd init from scratch. The idea is to guide the user along. Not having the user visit the documentation page unless they want to deep-dive is a win in my books.

Proposal

azd init shows "Starter Template" instead of "Empty Template" for the first selection in the prompt.

The "Starter Template" will have the following:

  • Valid azure.yaml with comments helping the user along.
  • Valid infrastructure files that sets up azd environment tagging + creates an empty resource group. In the future, we could call out to our core bicep registry as a quickstart.
  • Starter GitHub or AzDo workflow template for CI/CD.

Asset files for "Starter Template" will be stored and shipped in our binary using go:embed, since we want the starter template to always stay in-sync with the azd binary.

@savannahostrowski
Copy link

+1 to what Wei is suggesting above. I really like this proposal. We need to get a bit better at guiding new users and having them fall into a pit of success.

@puicchan
Copy link
Contributor

puicchan commented Feb 9, 2023

I am fine as long as you think about the scenario when customers have an app (with or without Bicep files) and still can use azd init to scaffold the basic azure.yaml, CICD workflow, etc. files they need. We need to make sure they are set up for success if 1. they do not want to use App Fingerprint 2. App Fingerprint is not able to give them what they need and they run azd init the second time to manually set things up.

@jongio
Copy link
Member Author

jongio commented Feb 9, 2023

I'd also include .devcontainer files

@rajeshkamal5050
Copy link
Contributor

@savannahostrowski @ellismg Not in scope for GA. Moving this to Gallium.

@savannahostrowski
Copy link

I think this is polish. I'd like to talk about addressing this before GA.

@spboyer
Copy link
Member

spboyer commented Mar 23, 2023

+1 @savannahostrowski , I'd also add that in addition to polish, this sets up a user for success when starting their own template, devifying their own, or working on a "build-up" process. Seems an easy win pre GA.

@weikanglim
Copy link
Contributor

weikanglim commented Apr 28, 2023

We're going to first add starter assets for bicep and terraform, the proposal has been finalized with @savannahostrowski 's blessing as follows:

Changes

azd init shows additionally "Starter - Bicep (azd-bicep-starter)" and "Starter - Terraform (azd-terraform-starter)".

The starters are just like other existing ToDo templates, available @ Azure-Samples/azd-bicep-starter and Azure-Samples/azd-terraform-starter respectively.

The starters have the following:

  • Valid azure.yaml with comments helping the user along.
  • Valid infrastructure files that sets up azd environment tagging + creates an empty resource group.
  • Starter GitHub or AzDo workflow template for CI/CD.
  • .devcontainer for a basic setup.

We will rename "Empty Template" -> "Minimal"

Testing

The templates will be validated via our normal bicep-lint processes, and in template-tests.sh a provision + down is performed to ensure the template can be provisioned. Deploy is skipped since no code is available.

@jongio
Copy link
Member Author

jongio commented May 1, 2023

@weikanglim - Please use azd-starter-{name} format so we can always have azd starter at the beginning of the name and add more tech/options down the road. cc / @savannahostrowski

@weikanglim
Copy link
Contributor

weikanglim commented May 1, 2023

@jongio Naming is hard. I can see us going either way on it, but I do find that azd-bicep-starter reads better than azd-starter-bicep. azd-{scenario}-starter is also a perfectly valid format IMO. I hope we're not over-optimizing for our slight internal benefits.

@savannahostrowski @ellismg

Some data from Microsoft repositories suggests that *-starter-kit seems to be popular.

https://github.com/orgs/microsoft/repositories?q=starter&type=all&language=&sort=
https://github.com/orgs/azure/repositories?q=starter&type=all&language=&sort=

@weikanglim
Copy link
Contributor

Late thought here: Do you mean it's better for search engines to do azd-starter*? And organizationally, it may help group starters? I could see those benefits. Just want a second guidance before moving in that direction.

@savannahostrowski
Copy link

I'm not sure that having bicep/terraform ahead of starter in the repo name really optimizes for anything. I'd probably just go with what Jon outlined above for easier grouping etc.

weikanglim added a commit that referenced this issue May 2, 2023
Add new starter templates for bicep and terraform.

The starters have the following:
- Valid `azure.yaml` with comments helping the user along.
- Valid infrastructure files that sets up `azd` environment tagging + creates an empty resource group.
- Starter `GitHub` or `AzDo` workflow template for CI/CD.
- `.devcontainer` for a basic setup.

The starters are validated by `./template-tests.sh` to guarantee that the `azure.yaml` + `main.(bicep/tf)` is guaranteed to be valid using a `provision`, `deploy`, `down` flow.  `bicep-lint` runs to ensure the bicep doesn't violate bicep best practices.

`azd init` also now allows showing of display names. The new starter templates take use of this, showing `Starter - Bicep (azd-bicep-starter)` instead of `Azure-Samples/azd-bicep-starter`. A follow-up PR will start expanding the usage.

Fixes #135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment