From 0881ea0159261d910251cd40778251c9008a5992 Mon Sep 17 00:00:00 2001 From: Marc Schweigert Date: Fri, 10 May 2024 07:40:34 -0400 Subject: [PATCH 1/3] Update parameter --target-url to --target-env in installCatalog action --- src/actions/installCatalog.ts | 2 +- test/actions/installCatalog.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actions/installCatalog.ts b/src/actions/installCatalog.ts index 83991908..9a6d8e26 100644 --- a/src/actions/installCatalog.ts +++ b/src/actions/installCatalog.ts @@ -27,7 +27,7 @@ export async function installCatalog(parameters: InstallCatalogParameters, runne const validator = new InputValidator(host); validator.pushInput(pacArgs, "--catalog-item-id", parameters.catalogItemId); - validator.pushInput(pacArgs, "--target-url", parameters.targetEnvironmentUrl); + validator.pushInput(pacArgs, "--target-env", parameters.targetEnvironmentUrl); validator.pushInput(pacArgs, "--settings", parameters.settings); validator.pushInput(pacArgs, "--target-version", parameters.targetVersion); validator.pushInput(pacArgs, "--poll-status", parameters.pollStatus); diff --git a/test/actions/installCatalog.test.ts b/test/actions/installCatalog.test.ts index b34082e3..9a192f85 100644 --- a/test/actions/installCatalog.test.ts +++ b/test/actions/installCatalog.test.ts @@ -63,7 +63,7 @@ describe("action: install catalog", () => { await runActionWithMocks(installCatalogParameters); authenticateEnvironmentStub.should.have.been.calledOnceWith(pacStub, mockClientCredentials); - pacStub.should.have.been.calledOnceWith("catalog", "install", "--catalog-item-id", mockedHost.catalogItemId, "--target-url", mockedHost.targetEnvironmentUrl); + pacStub.should.have.been.calledOnceWith("catalog", "install", "--catalog-item-id", mockedHost.catalogItemId, "--target-env", mockedHost.targetEnvironmentUrl); clearAuthenticationStub.should.have.been.calledOnceWith(pacStub); }); }); From a74efbdb1ff60536d81574cc1d3ca6d05bb10237 Mon Sep 17 00:00:00 2001 From: Marc Schweigert Date: Fri, 7 Jun 2024 08:44:24 -0400 Subject: [PATCH 2/3] work in progress --- .vscode/settings.json | 5 +++-- nuget.json | 20 ++++++++++---------- src/actions/installCatalog.ts | 6 ++++-- test/actions/installCatalog.test.ts | 14 ++++++++++++-- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 78664b27..009c4736 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "editor.tabSize": 2 -} + "editor.tabSize": 2, + "sarif-viewer.connectToGithubCodeScanning": "off" +} \ No newline at end of file diff --git a/nuget.json b/nuget.json index b1b7d0cb..2bc49ba6 100644 --- a/nuget.json +++ b/nuget.json @@ -4,28 +4,28 @@ "name": "nuget.org", "url": "https://api.nuget.org/v3-flatcontainer/", "authenticated": false, + "packages": [ + ] + }, + { + "name": "CAP_ISVExp_Tools_Stable", + "url": "https://pkgs.dev.azure.com/msazure/_packaging/b0441cf8-0bc8-4fad-b126-841a6184e784/nuget/v3/flat2/", + "authenticated": true, + "patEnvironmentVariable": "AZ_DevOps_Read_PAT", "packages": [ { "name": "Microsoft.PowerApps.CLI", - "version": "1.31.6", + "version": "1.32.4", "internalName": "pac" }, { "name": "Microsoft.PowerApps.CLI.Core.linux-x64", - "version": "1.31.6", + "version": "1.32.4", "internalName": "pac_linux", "chmod": "tools/pac" } ] }, - { - "name": "CAP_ISVExp_Tools_Stable", - "url": "https://pkgs.dev.azure.com/msazure/_packaging/b0441cf8-0bc8-4fad-b126-841a6184e784/nuget/v3/flat2/", - "authenticated": true, - "patEnvironmentVariable": "AZ_DevOps_Read_PAT", - "packages": [ - ] - }, { "name": "CAP_ISVExp_Tools_Daily", "url": "https://pkgs.dev.azure.com/msazure/_packaging/d3fb5788-d047-47f9-9aba-76890f5cecf0/nuget/v3/flat2/", diff --git a/src/actions/installCatalog.ts b/src/actions/installCatalog.ts index 9a6d8e26..8f163a5a 100644 --- a/src/actions/installCatalog.ts +++ b/src/actions/installCatalog.ts @@ -9,7 +9,8 @@ export interface InstallCatalogParameters extends CommonActionParameters { credentials: AuthCredentials; environmentUrl: string; catalogItemId: HostParameterEntry; - targetEnvironmentUrl: HostParameterEntry; + targetEnvironmentUrl?: HostParameterEntry; + targetEnvironment: HostParameterEntry; targetVersion?: HostParameterEntry; settings?: HostParameterEntry; pollStatus?: HostParameterEntry; @@ -27,7 +28,8 @@ export async function installCatalog(parameters: InstallCatalogParameters, runne const validator = new InputValidator(host); validator.pushInput(pacArgs, "--catalog-item-id", parameters.catalogItemId); - validator.pushInput(pacArgs, "--target-env", parameters.targetEnvironmentUrl); + validator.pushInput(pacArgs, "--target-url", parameters.targetEnvironmentUrl); + validator.pushInput(pacArgs, "--target-env", parameters.targetEnvironment); validator.pushInput(pacArgs, "--settings", parameters.settings); validator.pushInput(pacArgs, "--target-version", parameters.targetVersion); validator.pushInput(pacArgs, "--poll-status", parameters.pollStatus); diff --git a/test/actions/installCatalog.test.ts b/test/actions/installCatalog.test.ts index 9a192f85..baff4deb 100644 --- a/test/actions/installCatalog.test.ts +++ b/test/actions/installCatalog.test.ts @@ -53,17 +53,27 @@ describe("action: install catalog", () => { environmentUrl: environmentUrl, catalogItemId: { name: "CatalogItemId", required: true }, targetEnvironmentUrl: { name: "TargetEnvironmentUrl", required: true }, + targetEnvironment: { name: "TargetEnvironment", required: true }, settings: { name: "Settings", required: false }, targetVersion: { name: "TargetVersion", required: false }, pollStatus: { name: "PollStatus", required: false }, logToConsole: false }); - it("with required params, calls pac runner with correct args", async () => { + // it("with required params, calls pac runner with correct args", async () => { + // await runActionWithMocks(installCatalogParameters); + + // authenticateEnvironmentStub.should.have.been.calledOnceWith(pacStub, mockClientCredentials); + // pacStub.should.have.been.calledOnceWith("catalog", "install", "--catalog-item-id", mockedHost.catalogItemId, "--target-url", mockedHost.targetEnvironmentUrl); + // clearAuthenticationStub.should.have.been.calledOnceWith(pacStub); + // }); + + it("with required params, calls pac runner with correct args 2", async () => { + installCatalogParameters.targetEnvironment = { name: "TargetEnvironment", required: true }; await runActionWithMocks(installCatalogParameters); authenticateEnvironmentStub.should.have.been.calledOnceWith(pacStub, mockClientCredentials); - pacStub.should.have.been.calledOnceWith("catalog", "install", "--catalog-item-id", mockedHost.catalogItemId, "--target-env", mockedHost.targetEnvironmentUrl); + pacStub.should.have.been.calledOnceWith("catalog", "install", "--catalog-item-id", mockedHost.catalogItemId, "--target-env", mockedHost.targetEnvironment); clearAuthenticationStub.should.have.been.calledOnceWith(pacStub); }); }); From a54d415f03bb4d1f461535da07857ec7031bc550 Mon Sep 17 00:00:00 2001 From: Marc Schweigert Date: Fri, 7 Jun 2024 09:22:49 -0400 Subject: [PATCH 3/3] fixed tests --- nuget.json | 20 ++++++++++---------- src/actions/installCatalog.ts | 2 +- test/actions/installCatalog.test.ts | 15 +++++++-------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/nuget.json b/nuget.json index 2bc49ba6..fd02f3df 100644 --- a/nuget.json +++ b/nuget.json @@ -4,28 +4,28 @@ "name": "nuget.org", "url": "https://api.nuget.org/v3-flatcontainer/", "authenticated": false, - "packages": [ - ] - }, - { - "name": "CAP_ISVExp_Tools_Stable", - "url": "https://pkgs.dev.azure.com/msazure/_packaging/b0441cf8-0bc8-4fad-b126-841a6184e784/nuget/v3/flat2/", - "authenticated": true, - "patEnvironmentVariable": "AZ_DevOps_Read_PAT", "packages": [ { "name": "Microsoft.PowerApps.CLI", - "version": "1.32.4", + "version": "1.32.8", "internalName": "pac" }, { "name": "Microsoft.PowerApps.CLI.Core.linux-x64", - "version": "1.32.4", + "version": "1.32.8", "internalName": "pac_linux", "chmod": "tools/pac" } ] }, + { + "name": "CAP_ISVExp_Tools_Stable", + "url": "https://pkgs.dev.azure.com/msazure/_packaging/b0441cf8-0bc8-4fad-b126-841a6184e784/nuget/v3/flat2/", + "authenticated": true, + "patEnvironmentVariable": "AZ_DevOps_Read_PAT", + "packages": [ + ] + }, { "name": "CAP_ISVExp_Tools_Daily", "url": "https://pkgs.dev.azure.com/msazure/_packaging/d3fb5788-d047-47f9-9aba-76890f5cecf0/nuget/v3/flat2/", diff --git a/src/actions/installCatalog.ts b/src/actions/installCatalog.ts index 8f163a5a..2f5e5c1d 100644 --- a/src/actions/installCatalog.ts +++ b/src/actions/installCatalog.ts @@ -10,7 +10,7 @@ export interface InstallCatalogParameters extends CommonActionParameters { environmentUrl: string; catalogItemId: HostParameterEntry; targetEnvironmentUrl?: HostParameterEntry; - targetEnvironment: HostParameterEntry; + targetEnvironment?: HostParameterEntry; targetVersion?: HostParameterEntry; settings?: HostParameterEntry; pollStatus?: HostParameterEntry; diff --git a/test/actions/installCatalog.test.ts b/test/actions/installCatalog.test.ts index baff4deb..ded4fa7f 100644 --- a/test/actions/installCatalog.test.ts +++ b/test/actions/installCatalog.test.ts @@ -52,21 +52,20 @@ describe("action: install catalog", () => { credentials: mockClientCredentials, environmentUrl: environmentUrl, catalogItemId: { name: "CatalogItemId", required: true }, - targetEnvironmentUrl: { name: "TargetEnvironmentUrl", required: true }, - targetEnvironment: { name: "TargetEnvironment", required: true }, settings: { name: "Settings", required: false }, targetVersion: { name: "TargetVersion", required: false }, pollStatus: { name: "PollStatus", required: false }, logToConsole: false }); - // it("with required params, calls pac runner with correct args", async () => { - // await runActionWithMocks(installCatalogParameters); + it("with required params, calls pac runner with correct args", async () => { + installCatalogParameters.targetEnvironmentUrl = { name: "TargetEnvironmentUrl", required: true }; + await runActionWithMocks(installCatalogParameters); - // authenticateEnvironmentStub.should.have.been.calledOnceWith(pacStub, mockClientCredentials); - // pacStub.should.have.been.calledOnceWith("catalog", "install", "--catalog-item-id", mockedHost.catalogItemId, "--target-url", mockedHost.targetEnvironmentUrl); - // clearAuthenticationStub.should.have.been.calledOnceWith(pacStub); - // }); + authenticateEnvironmentStub.should.have.been.calledOnceWith(pacStub, mockClientCredentials); + pacStub.should.have.been.calledOnceWith("catalog", "install", "--catalog-item-id", mockedHost.catalogItemId, "--target-url", mockedHost.targetEnvironmentUrl); + clearAuthenticationStub.should.have.been.calledOnceWith(pacStub); + }); it("with required params, calls pac runner with correct args 2", async () => { installCatalogParameters.targetEnvironment = { name: "TargetEnvironment", required: true };