Граф коммитов

1698 Коммитов

Автор SHA1 Сообщение Дата
Daniel Jurek 5a52dbf8bb
vscode signing (#4533)
* Set up signing

* Use branch for build-tools

* ref naming

* Path/Pattern

* Add vsce publishing

* Revert 1es-redirect.yml

* Add file paths explicitly
2024-11-26 15:35:06 -08:00
Azure SDK Bot 16a26033a5
Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#4591) 2024-11-26 22:32:47 +00:00
Matt Ellis 84b605c64f
ci: Add Jeff to CODEOWNERS for cli/azd (#4587)
Welcome to the team, Jeff!
2024-11-25 18:44:51 +00:00
Matt Ellis 6cd82ae9ff
dotnet: Support `dotnet publish` to produce container image (#4573)
The `dotnet` tool has native support for producing (and pushing) a
container image. This does not require a local docker daemon and in
general "does the right thing" and is the prefered way for .NET
customers to produce container
images. https://learn.microsoft.com/dotnet/core/docker/publish-as-container
gives a good overview of how this support works and we've been using
it to build and push container images for Aspire apps.

This change updates things such that we can use this support when
building a non Aspire based .NET app. If a `Dockerfile` exists, we
respect it, but otherwise instead of trying to use Oryx to produce a
container image, we will use `dotnet publish`.

In addition, we now use 8080 as the default port of a `dotnet` based
application (with no Dockerfile) as that's the default port used by
the standard ASP.NET base image.

A new recorded test was added - it builds on top of the existing
`containerapp` sample, and the test aranges to remove the `Dockerfile`
file from the template before running `up`.

Fixes #2632
Fixes #4583
2024-11-22 22:09:57 +00:00
Matt Ellis 67098119bb
tests: Re-enable tests disabled against #4341 (#4563)
We should be able to re-enable the tests now. The one exception is the
`azd login` test that validated login with a long lived client secret,
since we no longer have a service principal with a long lived client
secret.

We'll have to make due without the end to end coverage here - but in
practice we have good coverage at the unit test level of much of the
code here, so we should be okay.

Contributes To #4564
2024-11-21 14:30:19 -08:00
Matt Ellis 3818b62c8c
ci: Update bicep in lint-bicep to v0.31.92 (#4565)
The current version that is installed on the runners (0.31.34) has
some bugs around linting and causes lint warnings during our
legs. These errors are not present on the latest Bicep CLI.

Force an upgrade of the binary that is installed as part of the test
runner to latest version. We should be able to remove this step once
new image is built with an upgraded bicep (the `README.md` at
https://github.com/actions/runner-images/tree/main/images/ubuntu has
information about what is on the runner.)
2024-11-19 10:42:15 -08:00
Victor Vazquez 87586f8374
Support azd hooks out of azure.yaml, Part I of merging azd operation to hooks (#4244)
* service hooks

* As part of merging azd operation and hooks, this PR allows users to define hooks outside of azure.yaml as individual files with the name azd.hooks.[yaml | yml].

The file can be placed in the /infra folder for project level hooks or inside service's folder for service level hooks.

This will allow generators like Aspire to include hooks as part of the infrastructure code (w/o touching azure.yaml).  Then, when running azd infra synth, the hooks are part of the infrastructure and users can delete the infra folder to go back to full Aspire in-memory generation w/o touching azure.yaml.

After this PR, I am planning to move the azd operations to become a valid built-in hook and delete the alpha feature for azd operations and the entire feature in favor of just using the hooks strategy
2024-11-15 10:48:20 -08:00
Azure SDK Bot a49be25055
Increment CLI version after release (#4551) 2024-11-14 20:56:31 +00:00
Rujun Chen 4d33260ec6
fix: infra generation - passing by value in for range (#4556)
Fix a bug within the for-loop for reverse infra generation mapping. The value should be referenced via pointer to persist modification.
2024-11-14 08:20:30 -08:00
Matt Ellis 6e16f37beb
ci: Use TME via OIDC in build-cli (#4519)
Now that `azd` supports OIDC in Azure Pipelines via #4343, let's use
it in the `build-cli` leg of CI. Since we now use OIDC, we can also
migrate to the TME environment for the resources created during our
tests, by using the new `azd-service-connection` service connection.

In addition to the build authoring updates, I needed to make some
small changes to the integration testing framework and recording
framework to get these changes to work when running in playback mode.

I added `AZD_DEBUG_LOGIN_FORCE_SUBSCRIPTION_REFRESH` which can be used
to force `azd login` to load (and cache) subscriptions when you log
in. This refresh does not usually happen for service principal based
logins, but we want it to happen here so that the subscription list
can be served from cache instead of hitting the `/subscriptions`
endpoint of ARM to list subscriptions in each test (and record the
result). This also ensures the environment during playback is a bit
closer to the one like a developer will have when hacking on `azd`
(since they too will have run `azd login` locally thus primed their
subscription cache).

Moving to the TME user also exposed an issue with `azd` during
playback if the list of subscriptions the user has does not include
the subscription that was used for a recorded test. In this case,
`azd` could end up trying to fetch information about this
subscription, leading to test failures because this generates requests
that don't have recorded interactions. To work around this issue, I've
added a new `AZD_DEBUG_SYNTHETIC_SUBSCRIPTION` environment variable
that can be set to a subscription ID. When set, the
`SubscriptionManager` ensures the list of subscriptions returned by
`GetSubscriptions` includes an entry for this subscription. The
integration test framework arranges for this value to be set during
playback. This allows the rest of the test to work (the fact that the
principal running the test doesn't have access to the subscription
used for the recording ends up not mattering, since we serve all
requests from the recordings instead of against live Azure).

Finally, we needed to add the endpoint that is used inside Azure
DevOps to fetch the ID token during the OIDC flow to the list of URLs
that the recording infrastructure that should not be recorded.

With this change, the `azd-login` step is no longer used across any
pipelines, so we can remove it.

Fixes #4341
Fixes #4501
2024-11-13 10:04:42 -08:00
Victor Vazquez 5b92e0687e
Release changelog for v1.11.0 (#4546)
* wip

* cl ready
2024-11-12 21:49:34 -08:00
Wei Lim 7b89277d41
add show for resources (#4534)
Co-authored-by: Victor Vazquez <vhvb1989@gmail.com>
2024-11-13 03:17:18 +00:00
Wei Lim d0937f92d3
change color of multiselect (#4544) 2024-11-12 19:13:52 -08:00
Wei Lim 82d14d47e1
help flags to global (#4545) 2024-11-12 19:13:44 -08:00
Wei Lim ddafa38bcd
compose: add command (#4527)
`add` command that adds resource configuration to `azure.yaml`.

In this experience, users are able to proceed with running `provision` or `up` after committing the `azure.yaml` change.

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-11-12 13:56:32 -08:00
Wei Lim db0927019c
compose: update schema for alpha (#4539)
Update schema.alpha.json for composability.

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-11-12 13:12:20 -08:00
Rujun Chen bdfe989315
compose: Fix some errors found in scenario: frontend + backend + mongodb (#4526)
Fix some errors found in scenario: frontend + backend + mongodb.

1. Use 'cosmos.outputs.exportedSecrets' to specify the relationship between cosmos and ACA.
2. Upgrade cosmos to '0.8.1' to use 'cosmos.outputs.exportedSecrets'.
3. Move 'name' and 'location' to the frontend of params to keep align with other modules.
4. Add 'networkRestrictions' to make cosmos can be accessed in public network.
5. Use 'secretsExportConfiguration' instead of 'secretsKeyVault' to meet the new version of cosmos.
6. Delete 'dependsOn'.
7. Use '*' to allow all http methods.
2024-11-11 18:09:44 -08:00
Victor Vazquez 58b7124892
fix persist with default value params in aspire (#4524) 2024-11-11 10:26:21 -08:00
Wei Lim c049e5b316
surface minimal option (#4531)
Surface "Create a minimal project" as a main menu option in `init`.

This moves the initializing a minimal project flow from "Initialize a template -> Minimal" to "Create a minimal project".

When compose is enabled, only a project file is generated. When compose is not enabled, the previous functional behavior is retained -- no UX changes made.

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-11-11 10:20:43 -08:00
Matt Ellis f030c4c553
ci: Use ODIC and TME for `test-templates` (#4522)
This change reworks the `test-templates` test legs to use OIDC and
move to our TME subscription.

To do so, we capture the relevent `AZURESUBSCRIPTION_` environment
variables that are set by the AzureCLI task and then flow them into
the dev container when we run tests. This allows us to do `azd auth
login` inside the devcontainer but still use OIDC so we don't have a
long lived secret.

The call to `az login` was removed because we don't yet have a way to
have this work well with ODIC in the container. This means the
terraform flavor of the tests won't work (since auth is broken) but
these legs have been broken in both the bicep and terraform flavors
for a while, so this moves us in a better direction (and gets us off
of client secrets and onto TME for these tests).

Contributes To #4341
2024-11-07 21:43:28 +00:00
Wei Lim 9d71912097
easy-init: generate resources in `azure.yaml` (#4509)
Generate resources in `azure.yaml` and delay infrastructure generation if `alpha.compose` is enabled

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-11-07 12:54:49 -08:00
Matt Ellis dd46ca9b18
aspire: Consider Aspire Capability when detecting AppHost (#4447)
In addition to the `IsAspireHost` property we will now look at the
project capabilities to see if an `Aspire` capability is listed and if
treat the project as an AppHost project. This aligns `azd`'s behavior
with other tooling like Visual Studio which uses the project
capabilities to determine if the project is an App Host or not.

The .NET Team asked us to include this in our sniffing logic (but to
continue to check `IsAspireHost` as well).

Fixes #4364
2024-11-06 22:26:08 +00:00
Azure SDK Bot 209fd014d3
Increment CLI version after release (#4520) 2024-11-06 10:36:23 -08:00
Victor Vazquez 5e0b2d56a9
cl for release 1 10 4 (#4518) 2024-11-06 03:34:02 +00:00
Matt Ellis a1ee87286b
auth: Support `azure-pipelines` for `--federated-credential-provider` (#4343)
This change adds `azure-pipelines` as a supported value for the
`--federated-credential-provider` switch of `azd auth login`. This
provider can be used to do OIDC based login within the context of a
job running in Azure Pipelines.

When using this provider, `azd` uses the `AzurePipelinesCredential`
type to manage the OIDC dance. In addition to the client and tenant id
of the service principal you plan to authenticate with, we also need
the "service connection id" (this is the ID of the object created in
Azure Pipelines that contains the connection information) and the
system access token which is the security token for the running build
(it's what is used to authenticate to the OIDC endpoint that is being
run inside the pipeline which we use to fetch the federated
credential).  The client and tenant ids can be provided on the command
line, via the existing `--client-id` and `--tenant-id` switches, or,
when `azure-pipelines` is the `federated-credential-provider`, they
can be read from the `AZURESUBSCRIPTION_CLIENT_ID` and
`AZURESUBSCRIPTION_TEANT_ID` system environment varaibles.  The
service connection ID and acceess token are read from the
`AZURESUBSCRIPTION_SERVICE_CONNECTION_ID` and `SYSTEM_ACCESSTOKEN`
environment variaibles.

These system environment variables correspond to what the `AzureCLI@2`
sets when passing the `azureSubscription` parameter (after translating
the service connection name to a service connection ID, which is
handy) allowing something like this to work:

```yaml
- task: AzureCLI@2
  inputs:
    azureSubscription: azconnection
    scriptType: bash
    scriptLocation: inlineScript
    inlineScript: |
      azd auth login --federated-credential-provider "azure-pipelines"
      azd up
```

Note that while the AzureCLI task is used above, it's only used for
setting these environment variables and doing the service connection
name to id translation.  You could do something like the following
instead:

```yaml
- bash: |
    azd auth login --federated-credential-provider "azure-pipelines"
    azd up
  env:
    AZURE_SUBSCRIPTION_CLIENT_ID: "Your Client ID"
    AZURE_SUBSCRIPTION_TENANT_ID: "Your Tenant ID"
    AZURE_SUBSCRIPTION_SERVICE_CONNECTION_ID: "Your Service Connection ID"
    SYSTEM_ACCESSTOKEN: $(System.AccessToken)
```

And things will work as well. This can be useful in cases where you
can use the `AzureCLI@2` task directly.

We can consider writing our own task as some point as well.

Contributes To #4341
2024-11-05 18:15:47 -08:00
Matt Ellis e87f4b59f1
dotnet: Set `DOTNET_NOLOGO` when running external commands (#4515)
Per https://learn.microsoft.com/dotnet/core/tools/dotnet-environment-variables#dotnet_nologo:

> Specifies whether .NET welcome and telemetry messages are displayed
  on the first run. Set to true to mute these messages (values `true`,
  `1`, or `yes` accepted) or set to false to allow them (values
  `false`, `0`, or `no` accepted). If not set, the default is `false`
  and the messages will be displayed on the first run.

Since there are cases where we interpret the output of the `dotnet`
CLI (for example, when calling `dotnet msbuild
--getProperty:IsAspireHost`) we should set this value to ensure that
this message is not printed, which would break our deserialization
logic, which expects just JSON data to be printed to stdout.

Fixes #4513
2024-11-05 19:03:01 +00:00
Wallace Breza 593202cc4c
Devcenter environments Outputs API Integration (#4512)
Resolves #3958

This update moves away from manually reading Azure deployment outputs to leveraging the Outputs API directly from the ADE team. This enables a seamless outputs experience across their supported runners including ARM, Bicep, Terraform and other custom runners.
2024-11-05 10:00:07 -08:00
Wei Lim fed6b7ad08
yamlnode: Dotted-path YAML manipulation (#4465)
Add functionality for YAML node manipulation using dotted-path syntax.

This will be used in upcoming work that is aimed to manipulate YAML nodes to preserve comments, multi-line strings, and provide consistent formatting options for users.
2024-11-04 16:22:26 -08:00
Wei Lim 4325e10246
refactor port prompt (#4508)
Refactoring port prompting in infra_confirm.go

These changes are being teased out to reshare implementation across alpha-enabled vs regular code pathways.
2024-11-04 15:12:23 -08:00
Pablo Zaidenvoren 94c5489720
Remove the feature to include `golangci-lint` since it's already included with `ghcr.io/devcontainers/features/go:1` (#4506)
* Changed golangci-lint feature to updated repo

* remove the golangci-lint specific feature

* removed golangci-lint feature in light devcontainer

---------

Co-authored-by: Pablo Zaidenvoren <pablozaiden@users.noreply.github.com>
2024-11-04 13:02:10 -08:00
Wei Lim b3299e96cf
compose: add experimental envsubst support (#4477)
Add primitive support for envsubst expressions configuration.

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-11-01 14:38:42 -07:00
Wei Lim 21213c0da1
compose: generate openai in the backend (#4511)
Add backend infra generation for OpenAI models.

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-11-01 14:37:14 -07:00
Wei Lim 19d04b8dc3
Refactor db prompt (#4487)
Refactor db prompt logic in infra_confirm.go to reshare implementation in an upcoming change.
2024-10-31 11:38:28 -07:00
Wei Lim 5fecc07701
add alpha switch (#4500)
Refactor to integrate alpha switch for composability for a cleaner landing in the upcoming feature change.

In the upcoming feature change, we would want `azd init` without composability alpha feature enabled to continue materializing infrastructure as-is. If composability is enabled, we would want to hold the infrastructure in-memory.
2024-10-31 11:37:09 -07:00
Victor Vazquez 56eaa409e7
azdo ext add node 20 for warning (#4497)
* Update Install Azd - azdo task

* increase timeout for resolving 404
2024-10-29 12:48:19 -07:00
Wei Lim f67bbd7afe
compose: enable infra generation (#4475)
Enables infra generation, i.e. temporary infrastructure and synthesized infrastructure from resources.

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-10-28 17:41:31 -07:00
Azure SDK Bot 439055169a
Sync eng/common directory with azure-sdk-tools repository (#4495) 2024-10-28 16:29:37 -07:00
Wei Lim e27d9e742c
chore: refactor infra generation app_init.go (#4486)
This change refactors infra generation logic into a new method.

To set up a cleaner future diff, we also add alpha feature manager as a dependency of the infra generator.
2024-10-28 14:53:02 -07:00
Azure SDK Bot 3e9dc57979
Increment VSCode Extension version after release (#4496) 2024-10-28 16:14:24 -04:00
Alex Weininger 379b560469
Update version, changelog for 0.8.4 (#4494) 2024-10-28 14:15:11 -04:00
Azure SDK Bot b15ccaf35f
Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#4308) 2024-10-25 20:15:18 +00:00
Victor Vazquez c5afa7de6b
patch generate to quote params when missing (#4484) 2024-10-24 15:32:37 -07:00
Wei Lim 7511467d39
easy-init: Switch to avm (Azure Verified Modules) (#4455)
With this change, we switch easy-init's generated infrastructure to use avm (Azure Verified Modules).

Since AVM allows us to express resource definitions in a more condensed form, we employ the strategy of having a single ` resources.bicep` that uses all the different modules available is employed.

Notable behavioral changes introduced:

**Postgres**
- Server version upgraded from version 13 to version 15.
- Storage size reduced from 128GB to 32GB (AVM default).

**MongoDB**
 - Server version upgraded from 4.0 to 4.2.

**Redis**
- Redis is now implemented as an Azure Cache for Redis instance instead of previously as a container app image.

Environment variables are also standardized:
- POSTGRES_URL, MONGODB_URL, REDIS_URL all serves as the full connection string URI to the respective instances.

Contributes to: https://github.com/Azure/azure-dev-pr/issues/1682
2024-10-24 14:40:59 -07:00
Wei Lim 09cd9c404b
func: add mitigation for deployments that take awhile to "come alive" (#4449)
Add polling delay and retries for function app consumption deployments that take awhile to "come alive"

Fixes #4439
2024-10-24 13:59:02 -07:00
alexwolfmsft 331c0133d2
fix help for `azd template source add` (#4474)
Fix help text for `azd template source add`

- Short no longer has multiline text
- Replaced 'http://aka.ms/awesome-azd' with 'https://aka.ms/awesome-azd'

---------

Co-authored-by: Wei Lim <weilim@microsoft.com>
2024-10-24 11:04:14 -07:00
Wallace Breza 9ec227e8fa
Fixes panic on missing hook configuration (#4458)
Resolves an issue when an azure.yaml has missing hook configuration:
2024-10-24 10:40:24 -07:00
Victor Vazquez 8fd80cbbc4
fix projects with empty spaces aspire (#4472)
* use label as package out of repository and re-use for apphost project generation

* use names

* use GetDefaultProjectName

* fix `show` not using project name as AppName

* refactor as a function

* clean up one spot

* add copyright notice

* remove panic

---------

Co-authored-by: Wei Lim <weilim@microsoft.com>
2024-10-24 02:37:34 +00:00
Wei Lim f27b9d6574
add resources schema (#4466)
Add resources as a node.

Contributes to #4397,  https://github.com/Azure/azure-dev-pr/issues/1682
2024-10-23 15:09:08 -07:00
dependabot[bot] d3c4e0bd8d
Bump cookie and express in /templates/todo/api/js (#4464)
Bumps [cookie](https://github.com/jshttp/cookie) to 0.7.1 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `cookie` from 0.6.0 to 0.7.1
- [Release notes](https://github.com/jshttp/cookie/releases)
- [Commits](https://github.com/jshttp/cookie/compare/v0.6.0...v0.7.1)

Updates `express` from 4.21.0 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.21.0...4.21.1)

---
updated-dependencies:
- dependency-name: cookie
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 09:26:48 -07:00
Rujun Chen aa34833289
easy-init: auto detect port from Dockerfile (#4454)
Use the `EXPOSE` directives in a Dockerfile to default the port configuration for the service. 

- When multiple `EXPOSE` ports are present, we will prompt the user for port selection.
- When no Dockerfile or `EXPOSE` is present, the user will be asked as usual to provide a port number.

Completes #4443
2024-10-23 09:24:16 -07:00