Skip to content

Commit

Permalink
Test build and trigger build
Browse files Browse the repository at this point in the history
  • Loading branch information
snehapar9 committed Sep 23, 2023
1 parent 3e9bb7e commit 2f38443
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
28 changes: 14 additions & 14 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4912,28 +4912,28 @@ var ContainerAppHelper = /** @class */ (function () {
* @returns the default location if found, otherwise 'eastus2'
*/
ContainerAppHelper.prototype.getDefaultContainerAppLocation = function () {
var _a;
return __awaiter(this, void 0, void 0, function () {
var command, executionResult, azData, location_1, err_9;
return __generator(this, function (_b) {
switch (_b.label) {
var command, executionResult, providerInfo, resourceTypes, containerAppLocation, err_9;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
core.debug("Attempting to get the default location for the Container App service for the subscription.");
_b.label = 1;
_a.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
command = "provider show -n Microsoft.ContainerApp --output json";
_a.trys.push([1, 3, , 4]);
command = "provider show -n Microsoft.App --output json";
return [4 /*yield*/, new Utility_1.Utility().executeAndthrowIfError("az", command.split(' '))];
case 2:
executionResult = _b.sent();
azData = JSON.parse(executionResult.stdout);
location_1 = (_a = azData.resourceTypes.find(function (resourceType) {
return resourceType.resourceType === 'containerApps';
})) === null || _a === void 0 ? void 0 : _a.locations[0];
executionResult = _a.sent();
providerInfo = JSON.parse(executionResult.stdout);
resourceTypes = providerInfo.resourceTypes;
containerAppLocation = resourceTypes
.filter(function (resourceType) { return resourceType.resourceType === 'containerApps'; })
.map(function (resourceType) { return resourceType.locations[0]; });
// If successful, strip out double quotes, spaces and parentheses from the first location returned
return [2 /*return*/, !executionResult.stderr ? location_1.toLowerCase().replace(/["() ]/g, "") : "eastus2"];
return [2 /*return*/, !executionResult.stderr ? containerAppLocation.toLowerCase().replace(/["() ]/g, "") : "eastus2"];
case 3:
err_9 = _b.sent();
err_9 = _a.sent();
core.warning(err_9.message);
return [2 /*return*/, "eastus2"];
case 4: return [2 /*return*/];
Expand Down
17 changes: 10 additions & 7 deletions src/ContainerAppHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,17 @@ export class ContainerAppHelper {
public async getDefaultContainerAppLocation(): Promise<string> {
core.debug(`Attempting to get the default location for the Container App service for the subscription.`);
try {
const command = `provider show -n Microsoft.ContainerApp --output json`;
const command = `provider show -n Microsoft.App --output json`;
const executionResult = await new Utility().executeAndthrowIfError(`az`, command.split(' '));
const azData = JSON.parse(executionResult.stdout);
const location = azData.resourceTypes.find((resourceType: any) =>
resourceType.resourceType === 'containerApps'
)?.locations[0];
// Parse the JSON output
const providerInfo = JSON.parse(executionResult.stdout);
// Extract information about resource types
const resourceTypes = providerInfo.resourceTypes;
const containerAppLocation = resourceTypes
.filter((resourceType: any) => resourceType.resourceType === 'containerApps')
.map((resourceType: any) => resourceType.locations[0]);
// If successful, strip out double quotes, spaces and parentheses from the first location returned
return !executionResult.stderr ? location.toLowerCase().replace(/["() ]/g, "") : `eastus2`;
return !executionResult.stderr ? containerAppLocation.toLowerCase().replace(/["() ]/g, "") : `eastus2`;
} catch (err) {
core.warning(err.message);
return `eastus2`;
Expand Down Expand Up @@ -433,7 +436,7 @@ export class ContainerAppHelper {
'tar -C /usr/local/bin/ --no-same-owner -xzv pack)';
}
const shell = IS_WINDOWS_AGENT ? 'pwsh' : 'bash';
await exec.exec(shell, [command]);
await exec.exec(shell, [command])
} catch (err) {
core.error(`Unable to install the pack CLI. Error: ${err.message}`);
core.setFailed(err.message);
Expand Down

0 comments on commit 2f38443

Please sign in to comment.