Skip to content

Commit

Permalink
Rename provider -> extension in many places
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-c-martin committed Aug 22, 2024
1 parent 68f9bca commit cd450ea
Show file tree
Hide file tree
Showing 142 changed files with 872 additions and 880 deletions.
10 changes: 5 additions & 5 deletions docs/experimental-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ The following features can be optionally enabled through your `bicepconfig.json`
Should be enabled in tandem with `testFramework` experimental feature flag for expected functionality. Allows you to author boolean assertions using the `assert` keyword comparing the actual value of a parameter, variable, or resource name to an expected value. Assert statements can only be written directly within the Bicep file whose resources they reference. For more information, see [Bicep Experimental Test Framework](https://github.com/Azure/bicep/issues/11967).

### `dynamicTypeLoading`
Requires `extensibility` to be enabled. If enabled, users are able to fetch the azure resource type definitions from an OCI Registry as a runtime dependency. To fetch the type definitions the following syntax can be used. For example `provider 'br:mcr.microsoft.com/bicep/providers/[email protected]' as az`.
The provider definitions also support aliasing via `bicepconfig.json` similar to [`moduleAliases`](https://learn.microsoft.com/azure/azure-resource-manager/bicep/bicep-config-modules#aliases-for-modules). For example `provider 'br/public:[email protected]' as az`.
Requires `extensibility` to be enabled. If enabled, users are able to fetch the azure resource type definitions from an OCI Registry as a runtime dependency. To fetch the type definitions the following syntax can be used. For example `extension 'br:mcr.microsoft.com/bicep/extensions/[email protected]' as az`.
The extension definitions also support aliasing via `bicepconfig.json` similar to [`moduleAliases`](https://learn.microsoft.com/azure/azure-resource-manager/bicep/bicep-config-modules#aliases-for-modules). For example `extension 'br/public:[email protected]' as az`.

### `extendableParamFiles`
Enables the ability to extend bicepparam files from other bicepparam files.

### `extensibility`
Allows Bicep to use a provider model to deploy non-ARM resources. Currently, we support Kubernetes provider ([Bicep extensibility Kubernetes provider](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-extensibility-kubernetes-provider)) and Microsoft Graph provider ([Bicep templates for Microsoft Graph](https://aka.ms/graphbicep)).
Allows Bicep to use an extensibility model to deploy non-ARM resources. Currently, we support Kubernetes extension ([Bicep Kubernetes extension](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-extensibility-kubernetes-provider)) and Microsoft Graph extension ([Bicep templates for Microsoft Graph](https://aka.ms/graphbicep)).

### `extensionRegistry`
Requires `dynamicTypeLoading` and `extensibility` to be enabled. If enabled, users are able to fetch the third party resource type definitions from an OCI Registry as a runtime dependency. To fetch the type definitions the following syntax can be used. For example `extension 'br:thirdpartyregistry.azurecr.io/bicep/extension/[email protected]' as thirdparty`.
Expand Down Expand Up @@ -54,8 +54,8 @@ Should be enabled in tandem with `assertions` experimental feature flag for expe

## Other experimental functionality

### `publish-provider` CLI Command
Command that allows the publishing of providers to container registries. For more information, see [Using the Publish Provider Command](./experimental/publish-provider-command.md).
### `publish-extension` CLI Command
Command that allows the publishing of extensions to container registries. For more information, see [Using the Publish Extension Command](./experimental/publish-extension-command.md).

### Deployment Pane
The Deployment Pane is a UI panel in VSCode that allows you to connect to your Azure subscription and execute validate, deploy & whatif operations and get instant feedback without leaving the editor. For more information, see [Using the Deployment Pane](./experimental/deploy-ui.md).
21 changes: 21 additions & 0 deletions docs/experimental/publish-extension-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Using the `publish-extension` command (Experimental!)

## What is it?
The `publish-extension` command allows you to **publish** extensions to a registry of your choice. Simply specify a file and the registry extension reference.

## Using
`bicep publish-extension <file> --target <ref>`

### Arguments
`<file>` Path to the input file (index JSON file)\
`<ref>` The extension reference

### Options
`force` Overwrite existing published extension

### Examples
`bicep publish-extension` ./index.json --target br:example.azurecr.io/hello/world:v1\
`bicep publish-extension` ./index.json --target br:example.azurecr.io/hello/world:v1 --force

## Raising bugs or feature requests
Please raise bug reports or feature requests under [Bicep Issues](https://github.com/Azure/bicep/issues) as usual.
21 changes: 0 additions & 21 deletions docs/experimental/publish-provider-command.md

This file was deleted.

12 changes: 6 additions & 6 deletions docs/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The following is the active pseudo-grammar of the bicep language.
program -> statement* EOF
statement ->
targetScopeDecl |
providerDecl |
extensionDecl |
compileTimeImportDecl |
metadataDecl |
parameterDecl |
Expand All @@ -20,11 +20,11 @@ statement ->
targetScopeDecl -> "targetScope" "=" expression
providerDecl -> decorator* "provider" interpString(specification) providerWithClause? providerAsClause? NL
extensionDecl -> decorator* "extension" interpString(specification) extensionWithClause? extensionAsClause? NL
providerWithClause -> "with" object
extensionWithClause -> "with" object
providerAsClause -> "as" IDENTIFIER(alias)
extensionAsClause -> "as" IDENTIFIER(alias)
compileTimeImportDecl -> decorator* "import" compileTimeImportTarget compileTimeImportFromClause
Expand All @@ -34,9 +34,9 @@ compileTimeImportTarget ->
importedSymbolsList -> "{" ( NL+ ( importedSymbolsListItem NL+ )* )? "}"
importedSymbolsListItem -> IDENTIFIER(originalSymbolName) providerAsClause?
importedSymbolsListItem -> IDENTIFIER(originalSymbolName) extensionAsClause?
wildcardImport -> "*" providerAsClause
wildcardImport -> "*" extensionAsClause
compileTimeImportFromClause -> "from" interpString(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"resourceFunctions": {},
"settings": {
"name": "thirdpartyprovider",
"name": "thirdpartyextension",
"version": "1.2.3",
"isSingleton": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"resourceFunctions": {},
"settings": {
"name": "thirdpartyprovider",
"name": "thirdpartyextension",
"version": "1.2.3",
"isSingleton": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

/**
* Live tests for "bicep publish-provider".
* Live tests for "bicep publish-extension".
*
* @group live
*/
Expand All @@ -13,20 +13,20 @@ import { invokingBicepCommand } from "./utils/command";
import { pathToExampleFile, readFileSync, writeTempFile } from "./utils/fs";
import { getEnvironment } from "./utils/liveTestEnvironments";

describe("bicep publish-provider live", () => {
const testArea = "publish-provider";
describe("bicep publish-extension live", () => {
const testArea = "publish-extension";
const environment = getEnvironment();

it("should publish provider", () => {
it("should publish extension", () => {
const builder = new BicepRegistryReferenceBuilder(
environment.registryUri,
testArea,
);
const baseFolder = pathToExampleFile("providers" + environment.suffix);
const baseFolder = pathToExampleFile("extensions" + environment.suffix);
const indexJsonPath = path.join(baseFolder, "types/http/index.json");
const target = builder.getBicepReference("http", "0.0.1");

invokingBicepCommand("publish-provider", indexJsonPath, "--target", target)
invokingBicepCommand("publish-extension", indexJsonPath, "--target", target)
.withEnvironmentOverrides(environment.environmentOverrides)
.shouldSucceed();
});
Expand All @@ -36,27 +36,27 @@ describe("bicep publish-provider live", () => {
environment.registryUri,
testArea,
);
const baseFolder = pathToExampleFile("providers" + environment.suffix);
const baseFolder = pathToExampleFile("extensions" + environment.suffix);
const indexJsonPath = path.join(baseFolder, "types/http/index.json");
const target = builder.getBicepReference("http", "0.0.1");

invokingBicepCommand("publish-provider", indexJsonPath, "--target", target)
invokingBicepCommand("publish-extension", indexJsonPath, "--target", target)
.withEnvironmentOverrides(environment.environmentOverrides)
.shouldSucceed();

const bicepContents = readFileSync(
path.join(baseFolder, "main.bicep"),
).replace("$TARGET_REFERENCE", target);
const bicepPath = writeTempFile(
"restore-provider",
"restore-extension",
"main.bicep",
bicepContents,
);

const configContents = readFileSync(
path.join(baseFolder, "bicepconfig.json"),
);
writeTempFile("restore-provider", "bicepconfig.json", configContents);
writeTempFile("restore-extension", "bicepconfig.json", configContents);

// Building with --stdout should emit a valid result.
invokingBicepCommand("build", "--stdout", bicepPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

/**
* Tests for "bicep publish-provider".
* Tests for "bicep publish-extension".
*
* @group CI
*/
Expand All @@ -17,19 +17,19 @@ import {
writeTempFile,
} from "./utils/fs";

describe("bicep publish-provider", () => {
it("should publish provider to the file system", () => {
describe("bicep publish-extension", () => {
it("should publish extension to the file system", () => {
const indexJsonPath = pathToExampleFile(
"providers.prod",
"extensions.prod",
"types",
"http",
"index.json",
);
const targetPath = pathToTempFile("publish-provider", "provider.tgz");
const targetPath = pathToTempFile("publish-extension", "extension.tgz");
ensureParentDirExists(targetPath);

invokingBicepCommand(
"publish-provider",
"publish-extension",
"--target",
targetPath,
indexJsonPath,
Expand All @@ -40,18 +40,18 @@ describe("bicep publish-provider", () => {
expectFileExists(targetPath);

const bicepContents = readFileSync(
pathToExampleFile("providers.prod", "main.bicep"),
).replace("$TARGET_REFERENCE", "./provider.tgz");
pathToExampleFile("extensions.prod", "main.bicep"),
).replace("$TARGET_REFERENCE", "./extension.tgz");
const bicepPath = writeTempFile(
"publish-provider",
"publish-extension",
"main.bicep",
bicepContents,
);

const configContents = readFileSync(
pathToExampleFile("providers.prod", "bicepconfig.json"),
pathToExampleFile("extensions.prod", "bicepconfig.json"),
);
writeTempFile("publish-provider", "bicepconfig.json", configContents);
writeTempFile("publish-extension", "bicepconfig.json", configContents);

// Building with --stdout should emit a valid result.
invokingBicepCommand("build", "--stdout", bicepPath)
Expand Down
12 changes: 6 additions & 6 deletions src/Bicep.Cli.IntegrationTests/BuildCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public async Task Build_Valid_SingleFile_WithTemplateSpecReference_ShouldSucceed
//[DataRow("br:invalid.azureacr.io/bicep/extensions/az", false)]
//[DataRow("br/unknown:az", false)]
public async Task Build_Valid_SingleFile_WithExtensionDeclarationStatement(
string providerDeclarationSyntax,
string extensionDeclarationSyntax,
bool shouldSucceed,
string containingFolder = "")
{
Expand All @@ -132,12 +132,12 @@ public async Task Build_Valid_SingleFile_WithExtensionDeclarationStatement(
if (uri.Host.Contains("invalid")) { continue; }
var layer = await client.UploadBlobAsync(BinaryData.FromString(""));
var config = await client.UploadBlobAsync(BinaryData.FromString("{}"));
await client.SetManifestAsync(BicepTestConstants.GetBicepProviderManifest(layer, config), "2.0.0");
await client.SetManifestAsync(BicepTestConstants.GetBicepExtensionManifest(layer, config), "2.0.0");
}

// 3. create a main.bicep and save it to a output directory
var bicepFile = $"""
extension '{providerDeclarationSyntax}:2.0.0'
extension '{extensionDeclarationSyntax}:2.0.0'
""";
var tempDirectory = FileHelper.GetUniqueTestOutputPath(TestContext);
Directory.CreateDirectory(tempDirectory);
Expand Down Expand Up @@ -198,10 +198,10 @@ public async Task Build_Valid_SingleFile_WithExtensionDeclarationStatement(
}
if (shouldSucceed)
{
// 7. assert the provider files were restored to the cache directory
// 7. assert the extension files were restored to the cache directory
Directory.Exists(settings.FeatureOverrides!.CacheRootDirectory).Should().BeTrue();
var providerDir = Path.Combine(settings.FeatureOverrides.CacheRootDirectory!, ArtifactReferenceSchemes.Oci, containingFolder, "bicep$extensions$az", "2.0.0$");
Directory.EnumerateFiles(providerDir).ToList().Select(Path.GetFileName).Should().BeEquivalentTo(new List<string> { "types.tgz", "lock", "manifest", "metadata" });
var extensionDir = Path.Combine(settings.FeatureOverrides.CacheRootDirectory!, ArtifactReferenceSchemes.Oci, containingFolder, "bicep$extensions$az", "2.0.0$");
Directory.EnumerateFiles(extensionDir).ToList().Select(Path.GetFileName).Should().BeEquivalentTo(new List<string> { "types.tgz", "lock", "manifest", "metadata" });
}
}

Expand Down
Loading

0 comments on commit cd450ea

Please sign in to comment.