azd is written in Golang and requires Go 1.18 or above:
If you don't have a preferred editor for Go code, we recommend Visual Studio Code. We have a settings.json file checked in, so if you launch code from within cli/azd you should get our customizations.
It also requires the az CLI:
We have some additional linting tools that we run in CI, and you will want to be able to run locally:
In order to run some of the tests, you'll need the toolchain for all the languages we support:
Also, you'll want to install Docker (as we use that for some of our tests)
We use a fork based workflow for azd. Here are simple steps:
- Fork
azure/azure-devon GitHub. - Create a branch named
<some-description>(e.g.fix-123for a bug fix oradd-deploy-command) in your forked Git repository. - Push the branch to your fork on GitHub.
- Open a pull request in GitHub.
Here is a more in-depth guide to forks in GitHub.
As part of CI validation, we run a series of live tests which provision and deprovision Azure resources. For external contributors, these tests will not run automatically, but someone on the team will be able to run them for your PR on your behalf.
In VS Code you can create a launch.json that runs the tool with a specified set of arguments and in a specific folder, for example:
{
"name": "dev-azd (launch)",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}",
"args": [
"restore"
],
"cwd": "${workspaceFolder}"
},We use go test. The functional package contains end to end tests that run azd and deploy live resources. You need to ensure you have run go build to
build a copy of azd at the root of the repository. The tests look for that binary. We hope to improve this. Use the -run flag of go test to filter tests,
as usual. You'll want to pass a larger -timeout since these tests deploy live resources.
go test -timeout 20m -v ./...
go test -timeout 20m -v ./... -run Test_CLI_RestoreCommand
Run golangci-lint run ./...
On Windows you may need to add
C:\Program Files\Git\usr\binto%PATH%
- Install cspell
- CD to /cli/azd
- Run
cspell lint "**/*.go" --relative --config ./.vscode/cspell.yaml
Windows Security may block execution of unsigned .exe files. This may happen when validating unsigned .exe files produced in a PR build.
> azd version
Access is denied.
>
To fix:
- Run
where azd(cmd) or(Get-Command azd).Source(PowerShell) to get the command path - Click the Start button and type
Windows Security, select and launch the "Windows Security" application - Select
Virus & threat protectiontab on the left side of the window - Click the
Manage settingslink underVirus & threat protection settings - Scroll down in the window to the
Exclusionsheading and click theAdd or remove exclusions link - Select
Add an exclusionand add the path to the exe from step 1