Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] - Centralized management of provider versions using bicepconfig.json #13078

Merged
merged 89 commits into from Feb 28, 2024

Conversation

asilverman
Copy link
Contributor

@asilverman asilverman commented Jan 22, 2024

Overview

  • Initial implementation of centralized provider version management
  • Changes are hidden behind the DynamicTypeLoading feature flag and implementation is not fully featured
Microsoft Reviewers: Open in CodeFlow

@asilverman asilverman added the story: dynamic type loading Collects all work items related to decoupling of Bicep types from compiler label Jan 22, 2024
@asilverman asilverman self-assigned this Jan 22, 2024
Copy link
Contributor

github-actions bot commented Jan 22, 2024

Test this change out locally with the following install scripts (Action run 8086334010)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 8086334010
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 8086334010"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 8086334010
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 8086334010"

Copy link
Contributor

github-actions bot commented Jan 22, 2024

Test Results

    66 files   -     33      66 suites   - 33   23m 0s ⏱️ - 29m 51s
10 668 tests +     1  10 667 ✅ +     1  1 💤 ±0  0 ❌ ±0 
25 226 runs   - 12 546  25 224 ✅  - 12 545  2 💤  - 1  0 ❌ ±0 

Results for commit adb8430. ± Comparison against base commit f545e83.

♻️ This comment has been updated with latest results.

@asilverman asilverman force-pushed the asilverman/central-mgmt-of-providers branch 2 times, most recently from 50f0a8d to ebdb8ee Compare January 23, 2024 17:20
@asilverman asilverman force-pushed the asilverman/central-mgmt-of-providers branch from f93e017 to 39ac777 Compare January 24, 2024 21:13
@asilverman asilverman force-pushed the asilverman/central-mgmt-of-providers branch from 78449ed to 74434fe Compare January 26, 2024 18:54
Ariel Silverman added 5 commits February 22, 2024 11:43
…ndling of provider specifications. The error messages in several files were updated to provide more detailed information about the expected format of a provider specification string. The handling of provider specifications was also modified to accommodate different types of syntax. A new method was added to create a string literal with a specific text span, and the check for `syntax.IsSkipped` was removed as it is no longer needed with the updated error message format.

1. Updated error messages in `DynamicAzTypesTests.cs`, `ProviderImportTests.cs`, and `DiagnosticBuilder.cs` to provide more detailed information about the expected format of a provider specification string.
2. Added a new method `CreateStringLiteralWithTextSpan` in `SyntaxFactory.cs` to create a string literal with a specific text span.
3. Modified `ProviderSpecificationFactory.cs` to handle different types of syntax when creating a provider specification.
4. Removed the `isDynamicLoadingEnabled` parameter from the `ExpectedProviderSpecification` method in `DiagnosticBuilder.cs` and updated the error message.
5. Updated `Parser.cs` to use the new error message format in `ExpectedProviderSpecification`.
6. Updated `ModuleDispatcher.cs` to handle cases where the provider specification is null.
7. Updated `StringSyntax.cs` to include a method `GetInnerSpan` that returns the span between the quotes for a string token.
8. Updated `ErrorBuilderTests.cs` to reflect changes in the `ExpectedProviderSpecification` method.
9. Updated `ProviderSpecificationFactoryTests.cs` to include a new enum `SyntaxType` and updated test cases to use this new enum.
10. Updated `RegistryProviderTests.cs` to change the provider string in the test case.
11. Updated `SourceFileGroupingBuilder.cs` to use the new error message format in `ExpectedProviderSpecification`.
12. Updated `TypeAssignmentVisitor.cs` to remove the check for `syntax.IsSkipped` as it is no longer needed with the updated error message format.
@asilverman asilverman force-pushed the asilverman/central-mgmt-of-providers branch from f323165 to aa17e93 Compare February 27, 2024 17:54
Copy link
Contributor

@shenglol shenglol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of my comments is blocking, so approving the PR. We should probably still wait for Anthony's approval.

@asilverman asilverman merged commit 4573725 into main Feb 28, 2024
44 checks passed
@asilverman asilverman deleted the asilverman/central-mgmt-of-providers branch February 28, 2024 20:01
anthony-c-martin added a commit that referenced this pull request Feb 29, 2024
anthony-c-martin added a commit that referenced this pull request Feb 29, 2024
#13078 and #13487 had incompatible changes and were merged at the same
time. This PR fixes validation on the main branch.

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/13496)
anthony-c-martin added a commit that referenced this pull request Apr 3, 2024
This PR builds on top of #13078, #13542 and #13537 to complete the
implementation of "implicit" providers - e.g. giving the user the
ability to control which providers are available and imported by default
fully through the bicepconfig file.

## Example
Given the following bicepconfig file:
```json
{
  "providers": {
    "az": "builtin:",
    "foo": "br:example.azurecr.io/providers/foo:1.2.3"
  },
  "implicitProviders": ["foo"],
}
```
And `.bicep` files will now have `foo` restored from the registry, and
imported by default. In this example, `az` is *not* imported by default,
and would require an explicit `provider az` in any file wishing to use
it.

## Changes
* Implicit providers are fully supported in the restoration flow, and
errors are surfaced.
* The `DefaultNamespaceProvider` has been replaced with a purely
config-driven equivalent (`NamespaceProvider`). This also introduces a
stricter separation between `NamespaceProvider` (returns a list of
available namespace types including diagnostics), and
`NamespaceResolver` (take the list of available namespaces, and can be
queried to provide information about what is/isn't in scope - e.g. for
binding).
* Improve some of the diagnostics in error cases, add tests.
* Existing functionality should be unaffected.

## Outstanding issues
* Implicit providers introduce places where diagnostics can be surfaced
without a syntax to attach to. Some of the errors will need to be
updated to clarify the source of the problem (bicep config).
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/13725)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
story: dynamic type loading Collects all work items related to decoupling of Bicep types from compiler
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants