From c71755e28c371e8ee60450eec3c8be5f4ea6a6cb Mon Sep 17 00:00:00 2001 From: Josh De Winne Date: Mon, 13 May 2024 16:28:07 -0700 Subject: [PATCH 1/2] Adding ip family --- dist/clusters.d.ts | 4 ++-- dist/clusters.js | 9 ++++++--- dist/releases.js | 2 +- dist/releases.spec.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/clusters.ts | 11 ++++++++--- src/releases.spec.ts | 2 +- src/releases.ts | 2 +- 9 files changed, 23 insertions(+), 15 deletions(-) diff --git a/dist/clusters.d.ts b/dist/clusters.d.ts index 4551261..c7c7524 100644 --- a/dist/clusters.d.ts +++ b/dist/clusters.d.ts @@ -54,8 +54,8 @@ interface nodeGroup { instance_type: string; disk_gib: number; } -export declare function createCluster(vendorPortalApi: VendorPortalApi, clusterName: string, k8sDistribution: string, k8sVersion: string, clusterTTL: string, diskGib?: number, nodeCount?: number, minNodeCount?: number, maxNodeCount?: number, instanceType?: string, nodeGroups?: nodeGroup[], tags?: tag[]): Promise; -export declare function createClusterWithLicense(vendorPortalApi: VendorPortalApi, clusterName: string, k8sDistribution: string, k8sVersion: string, licenseId: string, clusterTTL: string, diskGib?: number, nodeCount?: number, minNodeCount?: number, maxNodeCount?: number, instanceType?: string, nodeGroups?: nodeGroup[], tags?: tag[]): Promise; +export declare function createCluster(vendorPortalApi: VendorPortalApi, clusterName: string, k8sDistribution: string, k8sVersion: string, clusterTTL: string, diskGib?: number, nodeCount?: number, minNodeCount?: number, maxNodeCount?: number, instanceType?: string, nodeGroups?: nodeGroup[], tags?: tag[], ipFamily?: string): Promise; +export declare function createClusterWithLicense(vendorPortalApi: VendorPortalApi, clusterName: string, k8sDistribution: string, k8sVersion: string, licenseId: string, clusterTTL: string, diskGib?: number, nodeCount?: number, minNodeCount?: number, maxNodeCount?: number, instanceType?: string, nodeGroups?: nodeGroup[], tags?: tag[], ipFamily?: string): Promise; export declare function pollForStatus(vendorPortalApi: VendorPortalApi, clusterId: string, expectedStatus: string, timeout?: number, sleeptimeMs?: number): Promise; export declare function getKubeconfig(vendorPortalApi: VendorPortalApi, clusterId: string): Promise; export declare function removeCluster(vendorPortalApi: VendorPortalApi, clusterId: string): Promise; diff --git a/dist/clusters.js b/dist/clusters.js index 8862be0..8403091 100644 --- a/dist/clusters.js +++ b/dist/clusters.js @@ -29,11 +29,11 @@ class StatusError extends Error { } } exports.StatusError = StatusError; -async function createCluster(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags) { - return await createClusterWithLicense(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, "", clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags); +async function createCluster(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags, ipFamily) { + return await createClusterWithLicense(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, "", clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags, ipFamily); } exports.createCluster = createCluster; -async function createClusterWithLicense(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, licenseId, clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags) { +async function createClusterWithLicense(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, licenseId, clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags, ipFamily) { const http = await vendorPortalApi.client(); const reqBody = { name: clusterName, @@ -65,6 +65,9 @@ async function createClusterWithLicense(vendorPortalApi, clusterName, k8sDistrib if (tags) { reqBody["tags"] = tags; } + if (ipFamily) { + reqBody["ip_family"] = ipFamily; + } const uri = `${vendorPortalApi.endpoint}/cluster`; const res = await http.post(uri, JSON.stringify(reqBody)); if (res.message.statusCode != 201) { diff --git a/dist/releases.js b/dist/releases.js index cef98cb..387bdc1 100644 --- a/dist/releases.js +++ b/dist/releases.js @@ -240,7 +240,7 @@ async function getReleaseByAppId(vendorPortalApi, appId, releaseSequence) { async function reportCompatibilityResult(vendorPortalApi, appSlug, releaseSequence, compatibilityResult) { // 1. get the app id from the app slug const app = await (0, applications_1.getApplicationDetails)(vendorPortalApi, appSlug); - // 2. promote the release + // 2. report the compatibility result await reportCompatibilityResultByAppId(vendorPortalApi, app.id, releaseSequence, compatibilityResult); } exports.reportCompatibilityResult = reportCompatibilityResult; diff --git a/dist/releases.spec.js b/dist/releases.spec.js index 2fc0d43..cbdbc45 100644 --- a/dist/releases.spec.js +++ b/dist/releases.spec.js @@ -41,7 +41,7 @@ describe("ReleasesService", () => { }); test("report compatibility results", () => { globalThis.provider.addInteraction({ - state: "release promoted", + state: "result reported", uponReceiving: "a request for reporting compatibility result", withRequest: { method: "POST", diff --git a/package-lock.json b/package-lock.json index a44a818..e4e77e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "replicated-lib", - "version": "0.0.1-beta.16", + "version": "0.0.1-beta.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "replicated-lib", - "version": "0.0.1-beta.16", + "version": "0.0.1-beta.17", "dependencies": { "@actions/core": "^1.10.0", "@types/node": "^20.9.2", diff --git a/package.json b/package.json index d94392b..314c82d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "replicated-lib", - "version": "0.0.1-beta.16", + "version": "0.0.1-beta.17", "description": "Can interact with the vendor portal api!", "scripts": { "build": "rm -rf dist && tsc --build", diff --git a/src/clusters.ts b/src/clusters.ts index 764deca..0270af4 100644 --- a/src/clusters.ts +++ b/src/clusters.ts @@ -81,9 +81,10 @@ export async function createCluster( maxNodeCount?: number, instanceType?: string, nodeGroups?: nodeGroup[], - tags?: tag[] + tags?: tag[], + ipFamily?: string ): Promise { - return await createClusterWithLicense(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, "", clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags); + return await createClusterWithLicense(vendorPortalApi, clusterName, k8sDistribution, k8sVersion, "", clusterTTL, diskGib, nodeCount, minNodeCount, maxNodeCount, instanceType, nodeGroups, tags, ipFamily); } export async function createClusterWithLicense( @@ -99,7 +100,8 @@ export async function createClusterWithLicense( maxNodeCount?: number, instanceType?: string, nodeGroups?: nodeGroup[], - tags?: tag[] + tags?: tag[], + ipFamily?: string ): Promise { const http = await vendorPortalApi.client(); @@ -135,6 +137,9 @@ export async function createClusterWithLicense( if (tags) { reqBody["tags"] = tags; } + if (ipFamily) { + reqBody["ip_family"] = ipFamily; + } const uri = `${vendorPortalApi.endpoint}/cluster`; const res = await http.post(uri, JSON.stringify(reqBody)); diff --git a/src/releases.spec.ts b/src/releases.spec.ts index 08c6972..2baf825 100644 --- a/src/releases.spec.ts +++ b/src/releases.spec.ts @@ -45,7 +45,7 @@ describe("ReleasesService", () => { test("report compatibility results", () => { globalThis.provider.addInteraction({ - state: "release promoted", + state: "result reported", uponReceiving: "a request for reporting compatibility result", withRequest: { method: "POST", diff --git a/src/releases.ts b/src/releases.ts index 609c927..5af4382 100644 --- a/src/releases.ts +++ b/src/releases.ts @@ -299,7 +299,7 @@ export async function reportCompatibilityResult(vendorPortalApi: VendorPortalApi // 1. get the app id from the app slug const app = await getApplicationDetails(vendorPortalApi, appSlug); - // 2. promote the release + // 2. report the compatibility result await reportCompatibilityResultByAppId(vendorPortalApi, app.id, releaseSequence, compatibilityResult); } From 28ac283ccbd471f0e5187b83d1a15af1887ac8bc Mon Sep 17 00:00:00 2001 From: Josh De Winne Date: Mon, 20 May 2024 19:59:24 -0700 Subject: [PATCH 2/2] merge main --- src/releases.spec.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/releases.spec.ts b/src/releases.spec.ts index 5e2843b..afb5f22 100644 --- a/src/releases.spec.ts +++ b/src/releases.spec.ts @@ -45,25 +45,6 @@ describe("Promote Release", () => { }); }); -<<<<<<< HEAD - test("report compatibility results", () => { - globalThis.provider.addInteraction({ - state: "result reported", - uponReceiving: "a request for reporting compatibility result", - withRequest: { - method: "POST", - path: "/app/1234abcd/release/1/compatibility" - }, - willRespondWith: { - status: 201, - headers: { "Content-Type": "application/json" } - } - }); - - const apiClient = new VendorPortalApi(); - apiClient.apiToken = "abcd1234"; - apiClient.endpoint = globalThis.provider.mockService.baseUrl; -======= describe("Report Results", () => { const mockServer = mockttp.getLocal(); const apiClient = new VendorPortalApi(); @@ -74,7 +55,6 @@ describe("Report Results", () => { mockServer.start(8282); }); afterEach(() => mockServer.stop()); ->>>>>>> main test("report compatibility results", async () => { const c11yResult: CompatibilityResult = {