Add --internal flag to azd x init for scaffolding first-party Go extensions#8570
Add --internal flag to azd x init for scaffolding first-party Go extensions#8570Copilot wants to merge 7 commits into
--internal flag to azd x init for scaffolding first-party Go extensions#8570Conversation
|
@copilot could we have the template files be separate files instead of being inlined? Like what's in |
Addressed in b92ef04 by moving the internal scaffold templates into embedded resource files and updating |
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
- Introduced a constant for the default extension version. - Updated internal scaffold logic to use the new version constant. - Refactored codeowners handling in the internal scaffold process. - Enhanced tests to reflect changes in default version behavior.
b92ef04 to
2795dfb
Compare
1355d8e to
c2224cf
Compare
--internal flag to azd x init for scaffolding first-party Go extensions
There was a problem hiding this comment.
Pull request overview
This PR extends the microsoft.azd.extensions developer-kit extension by adding an --internal mode to azd x init that scaffolds additional first-party (in-repo) Go extension assets (CI workflow, release pipeline, CODEOWNERS entry, and standard repo scripts/config) into the Azure/azure-dev repository layout.
Changes:
- Add
--internal(Go-only) and--codeownerssupport toazd x init, including CODEOWNERS insertion logic and internal repo-root discovery. - Add embedded internal scaffold templates for per-extension GitHub Actions lint workflow, Azure Pipelines release pipeline, and standard extension files (ci scripts, version.txt, cspell, golangci).
- Update spelling configuration and bump the developer-kit extension’s version/changelog.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/extensions/microsoft.azd.extensions/version.txt | Bumps the developer-kit extension version. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/resources.go | Embeds the new internal/ template tree for internal scaffolding. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/workflows/lint-ext.yml.tmpl | Template for generated per-extension lint workflow. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/pipelines/release-ext.yml.tmpl | Template for generated per-extension release pipeline. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/version.txt.tmpl | Template for generated extension version.txt. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/golangci.yaml | Dotless .golangci.yaml template content for generated extensions. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/cspell.yaml | Generated extension-local cspell config template. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/ci-test.ps1 | Generated extension test script template. |
| cli/azd/extensions/microsoft.azd.extensions/internal/resources/internal/go/extension/ci-build.ps1.tmpl | Generated extension build script template. |
| cli/azd/extensions/microsoft.azd.extensions/internal/cmd/init.go | Implements --internal scaffolding flow, CODEOWNERS handling, and repo-root discovery. |
| cli/azd/extensions/microsoft.azd.extensions/internal/cmd/init_test.go | Adds tests for internal scaffold output and CODEOWNERS behavior. |
| cli/azd/extensions/microsoft.azd.extensions/cspell.yaml | Moves/extends extension-local spelling overrides for new terminology. |
| cli/azd/extensions/microsoft.azd.extensions/CHANGELOG.md | Starts a new unreleased section and records the new feature. |
| cli/azd/.vscode/cspell.yaml | Removes a now-extension-scoped spelling override. |
Copilot's findings
- Files reviewed: 14/14 changed files
- Comments generated: 3
| func collectExtensionMetadataFromFlags(flags *initFlags) (*models.ExtensionSchema, error) { | ||
| language := flags.language | ||
| if flags.internalScaffold && language == "" { | ||
| language = "go" | ||
| } | ||
|
|
| @@ -1 +1 @@ | |||
| 0.11.2 No newline at end of file | |||
| 0.12.0 No newline at end of file | |||
Resolves #8569
This PR adds an
--internalflag toazd x initthat scaffolds a first-party Go extension directly into theAzure/azure-devrepository, wiring up the CI, release, and ownership plumbing that every in-repo extension needs.When
--internalis set, language selection is skipped and defaults to Go, as internal scaffolding currently only supports Go. A companion--codeownersflag (also promptable in interactive mode) controls the GitHub handles/teams added to.github/CODEOWNERS.The scaffold writes files in two locations. Inside the new extension directory (
cli/azd/extensions/<id>/):ci-build.ps1— build scriptci-test.ps1— test scriptversion.txt— initial version (0.0.1)cspell.yaml— extension-local spelling config importing the shared config.golangci.yaml— linter config matching the other first-party extensionsAt the repository level:
.github/workflows/lint-ext-<id>.yml— per-extension lint workfloweng/pipelines/release-ext-<id>.yml— per-extension release pipeline.github/CODEOWNERSentry, inserted in alphabetical order within the extensions block (CODEOWNERS is last-match-wins, so ordering matters) and idempotent on re-runThe extension id is validated before any paths are derived, and the repository root is located by walking up from the working directory and checking for the expected repo markers. Templates are embedded via
go:embed(the.golangci.yamltemplate is stored dotless becausego:embedexcludes dotfiles, then written with the leading dot).Tests cover the generated scaffold contents, CODEOWNERS ordering and idempotency, CODEOWNERS parsing, and the
.golangci.yamloutput. The cspell words specific to this extension now live in the extension's owncspell.yamlrather than the central config.Screenshots