-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in local-deploy, add live test for OCI (#14592)
Fix bug in local-deploy, add live test for OCI ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/14592)
- Loading branch information
1 parent
cdb0fd7
commit 132ade5
Showing
11 changed files
with
285 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/Bicep.Cli.E2eTests/src/examples/local-deploy/bicepconfig.ff.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"experimentalFeaturesEnabled": { | ||
"extensibility": true, | ||
"extensionRegistry": true, | ||
"localDeploy": true | ||
}, | ||
"extensions": { | ||
"mock": "$TARGET_REFERENCE" | ||
}, | ||
"cloud": { | ||
"currentProfile": "AzureUSGovernment", | ||
"credentialPrecedence": [ | ||
// used by CI | ||
"Environment", | ||
"AzureCLI" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/Bicep.Cli.E2eTests/src/examples/local-deploy/bicepconfig.prod.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"experimentalFeaturesEnabled": { | ||
"extensibility": true, | ||
"extensionRegistry": true, | ||
"localDeploy": true | ||
}, | ||
"extensions": { | ||
"mock": "$TARGET_REFERENCE" | ||
}, | ||
"cloud": { | ||
"currentProfile": "AzureCloud", | ||
"credentialPrecedence": ["AzureCLI"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
extension '../../temp/local-deploy/provider.tgz' | ||
extension mock | ||
|
||
param payload string | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
/** | ||
* Live tests for "bicep local-deploy". | ||
* | ||
* @group live | ||
*/ | ||
|
||
import os from "os"; | ||
import { invokingBicepCommand } from "./utils/command"; | ||
import { copyToTempFile, pathToExampleFile, pathToTempFile } from "./utils/fs"; | ||
import { | ||
platformSupportsLocalDeploy, | ||
publishExtension, | ||
} from "./utils/localdeploy"; | ||
import { getEnvironment } from "./utils/liveTestEnvironments"; | ||
import { BicepRegistryReferenceBuilder } from "./utils/br"; | ||
import { itif } from "./utils/testHelpers"; | ||
|
||
describe("bicep local-deploy", () => { | ||
const environment = getEnvironment(); | ||
const testArea = `local-deploy-live${environment.suffix}`; | ||
const builder = new BicepRegistryReferenceBuilder( | ||
environment.registryUri, | ||
testArea, | ||
); | ||
|
||
itif(platformSupportsLocalDeploy())( | ||
"should publish and run an extension published to a registry", | ||
() => { | ||
const baseFolder = pathToExampleFile("local-deploy"); | ||
const target = builder.getBicepReference("mock", "0.0.1"); | ||
|
||
const files = { | ||
bicep: copyToTempFile(baseFolder, "main.bicep", testArea), | ||
bicepparam: copyToTempFile(baseFolder, "main.bicepparam", testArea), | ||
bicepconfig: copyToTempFile( | ||
baseFolder, | ||
`bicepconfig${environment.suffix}.json`, | ||
testArea, | ||
{ | ||
relativePath: "bicepconfig.json", | ||
values: { | ||
$TARGET_REFERENCE: target, | ||
}, | ||
}, | ||
), | ||
}; | ||
|
||
const typesIndexPath = pathToTempFile(testArea, "types", "index.json"); | ||
publishExtension(typesIndexPath, target) | ||
.shouldSucceed() | ||
.withEmptyStdout(); | ||
|
||
invokingBicepCommand("local-deploy", files.bicepparam) | ||
.shouldSucceed() | ||
.withStdout( | ||
[ | ||
'Output sayHiResult: "Hello, World!"', | ||
"Resource sayHi (Create): Succeeded", | ||
"Result: Succeeded", | ||
"", | ||
].join(os.EOL), | ||
); | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.