diff --git a/cli/azd/CHANGELOG.md b/cli/azd/CHANGELOG.md index ccca46cff83..fc292a48913 100644 --- a/cli/azd/CHANGELOG.md +++ b/cli/azd/CHANGELOG.md @@ -1,14 +1,13 @@ # Release History -## 1.19.0-beta.1 (Unreleased) - -### Features Added - -### Breaking Changes +## 1.18.1 (2025-08-06) ### Bugs Fixed -### Other Changes +- [[5501]](https://github.com/Azure/azure-dev/pull/5501) infra gen when dotnet project is present. +- [[5566]](https://github.com/Azure/azure-dev/pull/5566) [VSServer] Ignoring projects.v1. +- [[5518]](https://github.com/Azure/azure-dev/pull/5518) [VSServer] Add suggestion text for resource group and Container App un-marshall errors during azd deploy. +- [[5528]](https://github.com/Azure/azure-dev/pull/5528) Fix login guard to skip interactive prompts in CI/CD environments. ## 1.18.0 (2025-07-17) diff --git a/cli/azd/internal/vsrpc/utils.go b/cli/azd/internal/vsrpc/utils.go index 90e2552fea4..18593ee8cd1 100644 --- a/cli/azd/internal/vsrpc/utils.go +++ b/cli/azd/internal/vsrpc/utils.go @@ -38,13 +38,11 @@ func appHostForProject( func servicesFromManifest(manifest *apphost.Manifest) []*Service { var services []*Service - for name, res := range manifest.Resources { - if res.Type == "project.v0" { - services = append(services, &Service{ - Name: name, - Path: *res.Path, - }) - } + for name, path := range apphost.ProjectPaths(manifest) { + services = append(services, &Service{ + Name: name, + Path: path, + }) } return services diff --git a/cli/azd/internal/vsrpc/utils_test.go b/cli/azd/internal/vsrpc/utils_test.go index 4304a5bcf6d..f73754f8e2c 100644 --- a/cli/azd/internal/vsrpc/utils_test.go +++ b/cli/azd/internal/vsrpc/utils_test.go @@ -9,6 +9,8 @@ import ( "path/filepath" "testing" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/azure/azure-dev/cli/azd/pkg/apphost" "github.com/azure/azure-dev/cli/azd/pkg/environment/azdcontext" "github.com/azure/azure-dev/cli/azd/pkg/project" "github.com/stretchr/testify/require" @@ -59,6 +61,112 @@ func Test_azdContext(t *testing.T) { require.Equal(t, filepath.Dir(nearestUnmatched), ctxDir.ProjectDirectory()) } +func Test_servicesFromManifest(t *testing.T) { + tests := []struct { + name string + manifest *apphost.Manifest + expected []*Service + }{ + { + name: "empty manifest", + manifest: &apphost.Manifest{ + Resources: map[string]*apphost.Resource{}, + }, + expected: []*Service{}, + }, + { + name: "manifest with project resources", + manifest: &apphost.Manifest{ + Resources: map[string]*apphost.Resource{ + "webapi": { + Type: "project.v0", + Path: to.Ptr("./src/WebApi/WebApi.csproj"), + }, + "frontend": { + Type: "project.v0", + Path: to.Ptr("./src/Frontend/Frontend.csproj"), + }, + }, + }, + expected: []*Service{ + { + Name: "webapi", + Path: "./src/WebApi/WebApi.csproj", + }, + { + Name: "frontend", + Path: "./src/Frontend/Frontend.csproj", + }, + }, + }, + { + name: "manifest with mixed resource types", + manifest: &apphost.Manifest{ + Resources: map[string]*apphost.Resource{ + "api": { + Type: "project.v0", + Path: to.Ptr("./Api/Api.csproj"), + }, + "database": { + Type: "container.v1", + Image: to.Ptr("postgres:latest"), + }, + "worker": { + Type: "project.v1", + Path: to.Ptr("./Worker/Worker.csproj"), + }, + }, + }, + expected: []*Service{ + { + Name: "api", + Path: "./Api/Api.csproj", + }, + { + Name: "worker", + Path: "./Worker/Worker.csproj", + }, + }, + }, + { + name: "manifest with no project resources", + manifest: &apphost.Manifest{ + Resources: map[string]*apphost.Resource{ + "redis": { + Type: "container.v0", + Image: to.Ptr("redis:latest"), + }, + "postgres": { + Type: "container.v0", + Image: to.Ptr("postgres:latest"), + }, + }, + }, + expected: []*Service{}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := servicesFromManifest(tt.manifest) + + require.Len(t, result, len(tt.expected)) + + // Convert to maps for easier comparison since order may vary + resultMap := make(map[string]string) + for _, svc := range result { + resultMap[svc.Name] = svc.Path + } + + expectedMap := make(map[string]string) + for _, svc := range tt.expected { + expectedMap[svc.Name] = svc.Path + } + + require.Equal(t, expectedMap, resultMap) + }) + } +} func createProject(prjDir string, appHostPath string) error { err := os.MkdirAll(prjDir, 0755) if err != nil { diff --git a/cli/version.txt b/cli/version.txt index 9d908a0acf0..ec6d649be65 100644 --- a/cli/version.txt +++ b/cli/version.txt @@ -1 +1 @@ -1.19.0-beta.1 +1.18.1