Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into avmupdates
Browse files Browse the repository at this point in the history
  • Loading branch information
Menghua1 committed Aug 23, 2024
2 parents a6a3010 + fda6f19 commit 9b54ddd
Show file tree
Hide file tree
Showing 341 changed files with 16,621 additions and 7,884 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "1.21"
},
"ghcr.io/guiyomh/features/golangci-lint:0":{},
"ghcr.io/devcontainers/features/docker-in-docker:1": {
"ghcr.io/devcontainers/features/docker-in-docker:2.11.0": {
"version": "latest",
"moby": true
},
Expand All @@ -33,5 +33,6 @@
"jinliming2.vscode-go-template"
]
}
}
},
"postCreateCommand": "go install gotest.tools/gotestsum@latest"
}
28 changes: 28 additions & 0 deletions .devcontainer/light/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Azure Developer CLI - Contributor",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "1.21"
},
"ghcr.io/guiyomh/features/golangci-lint:0":{},
"ghcr.io/devcontainers/features/docker-in-docker:2.11.0": {
"version": "latest",
"moby": true
}
},
"customizations": {
"vscode": {
"extensions": [
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"golang.go",
"ms-azuretools.vscode-bicep",
"eamodio.gitlens",
"hashicorp.terraform",
"jinliming2.vscode-go-template"
]
}
},
"postCreateCommand": "go install gotest.tools/gotestsum@latest"
}
2 changes: 1 addition & 1 deletion .github/workflows/cli-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g cspell
- run: npm install -g cspell@8.13.1
- name: Spell check for CLI source code
run: cspell lint '**/*.{go,md}' --config ./cli/azd/.vscode/cspell.yaml --root ./cli/azd --no-progress

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cspell-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g cspell
- run: npm install -g cspell@8.13.1
- name: Spell check for general files
run: cspell lint '**/*' --config ./.vscode/cspell.misc.yaml --relative --no-progress
2 changes: 1 addition & 1 deletion .github/workflows/templates-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g cspell
- run: npm install -g cspell@8.13.1
- name: Spell check for templates
run: cspell lint '**/*' --config ./templates/cspell.yaml --root ./templates --no-progress
2 changes: 1 addition & 1 deletion .github/workflows/vscode-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g cspell
- run: npm install -g cspell@8.13.1
- name: Spell check for vscode extension
run: cspell lint '**/*.ts' --config ./ext/vscode/.vscode/cspell.yaml --root ./ext/vscode --no-progress

Expand Down
3 changes: 2 additions & 1 deletion cli/azd/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ linters-settings:
comparison: true
lll:
# GitHub recommended for code review
line-length: 125
line-length: 125
tab-width: 4
8 changes: 8 additions & 0 deletions cli/azd/.vscode/cspell-azd-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ aspnetcore
asyncmy
asyncpg
azapi
azblob
AZCLI
azcorelog
azdcli
Expand All @@ -53,6 +54,7 @@ azureutil
azureyaml
Backticks
bicepparam
blockblob
BOOLSLICE
BUILDID
BUILDNUMBER
Expand All @@ -74,9 +76,11 @@ csharpapptest
cupaloy
custommaps
deletedservices
deviceid
devcenter
devcenters
devcentersdk
devdeviceid
devel
discarder
docf
Expand Down Expand Up @@ -108,6 +112,7 @@ goterm
gotest
gotestsum
hotspot
ignorefile
iidfile
ineffassign
jaegertracing
Expand All @@ -126,6 +131,7 @@ mgmt
mgutz
microsoftonline
missingkey
moby
mockarmresources
mockazcli
mongojs
Expand All @@ -150,6 +156,7 @@ otlptrace
otlptracehttp
overriden
paketobuildpacks
patternmatcher
pflag
posix
preinit
Expand Down Expand Up @@ -216,4 +223,5 @@ webfrontend
westus2
wireinject
yacspin
ymlt
zerr
6 changes: 4 additions & 2 deletions cli/azd/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"go.lintTool": "golangci-lint",
"go.testTimeout": "10m",
"files.associations": {
"*.bicept": "go-template"
}
"*.bicept": "go-template",
"*.yamlt": "go-template",
"*.ymlt": "go-template"
}
}
27 changes: 27 additions & 0 deletions cli/azd/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@

### Other Changes

## 1.9.6 (2024-08-13)

### Features Added

- [[4115]](https://github.com/Azure/azure-dev/pull/4115) Adding `alpha` feature `alpha.aca.persistIngressSessionAffinity`.

### Bugs Fixed

- [[4111]](https://github.com/Azure/azure-dev/pull/4111) Container Apps: Fail when explicit Dockerfile path not found.
- [[4149]](https://github.com/Azure/azure-dev/pull/4149) Remove Admin Access as default for all .Net Aspire services.
- [[4104]](https://github.com/Azure/azure-dev/pull/4104) Remove Azure Dev Ops git remote constraint for dev.azure.com only.
- [[4160]](https://github.com/Azure/azure-dev/pull/4160) Fix automatic generation of CI/CD files for .Net Aspire projects.
- [[4182]](https://github.com/Azure/azure-dev/pull/4182) Allow `.yaml` and `.yml` extension for azure-dev pipeline files.
- [[4187]](https://github.com/Azure/azure-dev/pull/4187) Fix panic during deployment progress rendering.

## 1.9.5 (2024-07-10)

### Features Added

- [[4080]](https://github.com/Azure/azure-dev/pull/4080) Add `azd env get-value`.

### Bugs Fixed

- [[4065]](https://github.com/Azure/azure-dev/pull/4065) Fix panic when a project has no endpoints.
- [[4074]](https://github.com/Azure/azure-dev/pull/4074) Fix error in retrieving cross-rg service plan.
- [[4073]](https://github.com/Azure/azure-dev/pull/4073) Fix bug where windows logic app passed isLinuxWebApp.

## 1.9.4 (2024-07-02)

### Features Added
Expand Down
9 changes: 4 additions & 5 deletions cli/azd/cmd/auth_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/MakeNowJust/heredoc/v2"
"github.com/azure/azure-dev/cli/azd/cmd/actions"
"github.com/azure/azure-dev/cli/azd/internal"
"github.com/azure/azure-dev/cli/azd/internal/runcontext"
"github.com/azure/azure-dev/cli/azd/pkg/account"
"github.com/azure/azure-dev/cli/azd/pkg/auth"
"github.com/azure/azure-dev/cli/azd/pkg/contracts"
Expand Down Expand Up @@ -257,8 +258,6 @@ func newLoginAction(
}
}

const cLoginSuccessMessage = "Logged in to Azure."

func (la *loginAction) Run(ctx context.Context) (*actions.ActionResult, error) {
if len(la.flags.scopes) == 0 {
la.flags.scopes = la.authManager.LoginScopes()
Expand Down Expand Up @@ -300,7 +299,7 @@ func (la *loginAction) Run(ctx context.Context) (*actions.ActionResult, error) {
var msg string
switch res.Status {
case contracts.LoginStatusSuccess:
msg = cLoginSuccessMessage
msg = "Logged in to Azure."
case contracts.LoginStatusUnauthenticated:
msg = "Not logged in, run `azd auth login` to login to Azure."
default:
Expand Down Expand Up @@ -331,7 +330,7 @@ func (la *loginAction) Run(ctx context.Context) (*actions.ActionResult, error) {
}
}

la.console.Message(ctx, cLoginSuccessMessage)
la.console.Message(ctx, "Logged in to Azure.")
return nil, nil
}

Expand Down Expand Up @@ -534,7 +533,7 @@ func parseUseDeviceCode(ctx context.Context, flag boolPtr, commandRunner exec.Co
useDevCode = runningOnCodespacesBrowser(ctx, commandRunner)
}

if auth.ShouldUseCloudShellAuth() {
if runcontext.IsRunningInCloudShell() {
// Following az CLI behavior in Cloud Shell, use device code authentication when the user is trying to
// authenticate. The normal interactive authentication flow will not work in Cloud Shell because the browser
// cannot be opened or (if it could) cannot be redirected back to a port on the Cloud Shell instance.
Expand Down
14 changes: 7 additions & 7 deletions cli/azd/cmd/auth_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/require"
)

const cManagementScope = "https://management.azure.com//.default"
const managementScope = "https://management.azure.com//.default"

func TestAuthToken(t *testing.T) {
wasCalled := false
Expand All @@ -34,7 +34,7 @@ func TestAuthToken(t *testing.T) {
wasCalled = true

// Default value when explicit scopes are not provided to the command.
require.ElementsMatch(t, []string{cManagementScope}, options.Scopes)
require.ElementsMatch(t, []string{managementScope}, options.Scopes)

return azcore.AccessToken{
Token: "ABC123",
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestAuthTokenSysEnv(t *testing.T) {
buf := &bytes.Buffer{}

token := authTokenFn(func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {
require.ElementsMatch(t, []string{cManagementScope}, options.Scopes)
require.ElementsMatch(t, []string{managementScope}, options.Scopes)
return azcore.AccessToken{
Token: "ABC123",
ExpiresOn: time.Unix(1669153000, 0).UTC(),
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestAuthTokenSysEnvError(t *testing.T) {
buf := &bytes.Buffer{}

token := authTokenFn(func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {
require.ElementsMatch(t, []string{cManagementScope}, options.Scopes)
require.ElementsMatch(t, []string{managementScope}, options.Scopes)
return azcore.AccessToken{
Token: "ABC123",
ExpiresOn: time.Unix(1669153000, 0).UTC(),
Expand Down Expand Up @@ -160,7 +160,7 @@ func TestAuthTokenAzdEnvError(t *testing.T) {
buf := &bytes.Buffer{}

token := authTokenFn(func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {
require.ElementsMatch(t, []string{cManagementScope}, options.Scopes)
require.ElementsMatch(t, []string{managementScope}, options.Scopes)
return azcore.AccessToken{
Token: "ABC123",
ExpiresOn: time.Unix(1669153000, 0).UTC(),
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestAuthTokenAzdEnv(t *testing.T) {
buf := &bytes.Buffer{}

token := authTokenFn(func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {
require.ElementsMatch(t, []string{cManagementScope}, options.Scopes)
require.ElementsMatch(t, []string{managementScope}, options.Scopes)
return azcore.AccessToken{
Token: "ABC123",
ExpiresOn: time.Unix(1669153000, 0).UTC(),
Expand Down Expand Up @@ -245,7 +245,7 @@ func TestAuthTokenAzdEnvWithEmpty(t *testing.T) {
buf := &bytes.Buffer{}

token := authTokenFn(func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {
require.ElementsMatch(t, []string{cManagementScope}, options.Scopes)
require.ElementsMatch(t, []string{managementScope}, options.Scopes)
return azcore.AccessToken{
Token: "ABC123",
ExpiresOn: time.Unix(1669153000, 0).UTC(),
Expand Down
14 changes: 8 additions & 6 deletions cli/azd/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/azure/azure-dev/cli/azd/cmd/actions"
"github.com/azure/azure-dev/cli/azd/internal"
"github.com/azure/azure-dev/cli/azd/pkg/async"
"github.com/azure/azure-dev/cli/azd/pkg/environment/azdcontext"
"github.com/azure/azure-dev/cli/azd/pkg/input"
"github.com/azure/azure-dev/cli/azd/pkg/output"
Expand Down Expand Up @@ -176,15 +177,16 @@ func (ba *buildAction) Run(ctx context.Context) (*actions.ActionResult, error) {
continue
}

buildTask := ba.serviceManager.Build(ctx, svc, nil)
go func() {
for buildProgress := range buildTask.Progress() {
buildResult, err := async.RunWithProgress(
func(buildProgress project.ServiceProgress) {
progressMessage := fmt.Sprintf("Building service %s (%s)", svc.Name, buildProgress.Message)
ba.console.ShowSpinner(ctx, progressMessage, input.Step)
}
}()
},
func(progress *async.Progress[project.ServiceProgress]) (*project.ServiceBuildResult, error) {
return ba.serviceManager.Build(ctx, svc, nil, progress)
},
)

buildResult, err := buildTask.Await()
if err != nil {
ba.console.StopSpinner(ctx, stepMessage, input.StepFailed)
return nil, err
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/cobra_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
"github.com/spf13/cobra"
)

const cDocsFlagName = "docs"

// CobraBuilder manages the construction of the cobra command tree from nested ActionDescriptors
type CobraBuilder struct {
container *ioc.NestedContainer
Expand Down Expand Up @@ -196,7 +194,7 @@ func (df *docsFlag) Set(value string) error {
}

commandPath := strings.ReplaceAll(c.CommandPath(), " ", "-")
commandDocsUrl := cReferenceDocumentationUrl + commandPath
commandDocsUrl := referenceDocumentationUrl + commandPath
openWithDefaultBrowser(ctx, console, commandDocsUrl)
})

Expand All @@ -221,7 +219,7 @@ func (cb *CobraBuilder) bindCommand(cmd *cobra.Command, descriptor *actions.Acti
},
}
flag := cmd.Flags().VarPF(
docsFlag, cDocsFlagName, "", fmt.Sprintf("Opens the documentation for %s in your web browser.", cmd.CommandPath()))
docsFlag, "docs", "", fmt.Sprintf("Opens the documentation for %s in your web browser.", cmd.CommandPath()))
flag.NoOptDefVal = "true"

// Consistently registers output formats for the descriptor
Expand Down
2 changes: 1 addition & 1 deletion cli/azd/cmd/cobra_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func Test_RunDocsFlow(t *testing.T) {
cmd.SetArgs([]string{"--docs"})
err = cmd.ExecuteContext(*testCtx.Context)
require.NoError(t, err)
require.Equal(t, cReferenceDocumentationUrl+"root", calledUrl)
require.Equal(t, referenceDocumentationUrl+"root", calledUrl)
}

func Test_RunDocsAndHelpFlow(t *testing.T) {
Expand Down
9 changes: 8 additions & 1 deletion cli/azd/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"path/filepath"
"runtime"
"slices"
"strings"

"github.com/MakeNowJust/heredoc/v2"
Expand All @@ -17,6 +18,7 @@ import (
"github.com/azure/azure-dev/cli/azd/pkg/output"
"github.com/azure/azure-dev/cli/azd/pkg/output/ux"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
)

var userConfigPath string
Expand Down Expand Up @@ -454,8 +456,13 @@ func (a *configListAlphaAction) Run(ctx context.Context) (*actions.ActionResult,
if err != nil {
return nil, err
}

featureKeys := maps.Keys(features)
slices.Sort(featureKeys)

var alphaOutput []string
for _, alphaFeature := range features {
for _, alphaFeatureKey := range featureKeys {
alphaFeature := features[alphaFeatureKey]
alphaOutput = append(alphaOutput,
strings.Join(
[]string{
Expand Down
Loading

0 comments on commit 9b54ddd

Please sign in to comment.