From 64e8560601899085ca45b1a63ce4d1ac1b42b2c5 Mon Sep 17 00:00:00 2001 From: edaena Date: Mon, 10 Feb 2020 14:25:30 -0800 Subject: [PATCH 01/10] 948: Add unit test for spk service create-revision --- src/commands/service/create-revision.test.ts | 122 ++++++++++++ src/commands/service/create-revision.ts | 196 +++++++++++-------- 2 files changed, 239 insertions(+), 79 deletions(-) create mode 100644 src/commands/service/create-revision.test.ts diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts new file mode 100644 index 000000000..2b226ebdf --- /dev/null +++ b/src/commands/service/create-revision.test.ts @@ -0,0 +1,122 @@ +import os from "os"; +import path from "path"; +import shell from "shelljs"; +import uuid from "uuid/v4"; +import { write } from "../../config"; +import * as gitutils from "../../lib/gitutils"; +import * as azure from "../../lib/git/azure"; +import { IBedrockFile } from "../../types"; +import { + getDefaultRings, + getSourceBranch, + makePullRequest +} from "./create-revision"; +import { logger } from "@azure/keyvault-secrets"; + +jest + .spyOn(gitutils, "getCurrentBranch") + .mockReturnValueOnce(Promise.resolve("prod")) + .mockReturnValue(Promise.resolve("")); +const prSpy = jest + .spyOn(azure, "createPullRequest") + .mockReturnValue(Promise.resolve("done")); + +describe("Default rings", () => { + test("Get multiple default rings", () => { + const randomTmpDir = path.join(os.tmpdir(), uuid()); + shell.mkdir("-p", randomTmpDir); + const validBedrockYaml: IBedrockFile = { + rings: { + master: { isDefault: true }, + prod: { isDefault: false }, + westus: { isDefault: true } + }, + services: { + "foo/a": { + helm: { + // Missing 'chart' + chart: { + repository: "some-repo" + } + } + } + } + } as any; + + write(validBedrockYaml, randomTmpDir); + const defaultRings = getDefaultRings(undefined, validBedrockYaml); + expect(defaultRings.length).toBe(2); + expect(defaultRings[0]).toBe("master"); + expect(defaultRings[1]).toBe("westus"); + }); + + test("No default rings", () => { + const randomTmpDir = path.join(os.tmpdir(), uuid()); + shell.mkdir("-p", randomTmpDir); + const validBedrockYaml: IBedrockFile = { + rings: { + master: { isDefault: false }, + prod: { isDefault: false }, + westus: { isDefault: false } + }, + services: { + "foo/a": { + helm: { + // Missing 'chart' + chart: { + repository: "some-repo" + } + } + } + } + } as any; + + write(validBedrockYaml, randomTmpDir); + let hasError = false; + + try { + getDefaultRings(undefined, validBedrockYaml); + } catch (err) { + hasError = true; + } + expect(hasError).toBe(true); + }); +}); + +describe("Source branch", () => { + test("Defined source branch", async () => { + const branch = "master"; + const sourceBranch = await getSourceBranch(branch); + expect(sourceBranch).toBe("master"); + }); + test("Defined source branch", async () => { + const branch = undefined; + const sourceBranch = await getSourceBranch(branch); + expect(sourceBranch).toBe("prod"); + }); + test("No source branch", async () => { + const branch = undefined; + let hasError = false; + try { + await getSourceBranch(branch); + } catch (err) { + hasError = true; + } + expect(hasError).toBe(true); + }); +}); + +describe("Create pull request", () => { + test("Valid parameters", async () => { + await makePullRequest( + ["master"], + "testTitle", + "testBranch", + "testDescription", + "testOrg", + "testUrl", + "testToken" + ); + expect(prSpy).toHaveBeenCalled(); + }); +}); diff --git a/src/commands/service/create-revision.ts b/src/commands/service/create-revision.ts index 1f4565ee2..e856b7644 100644 --- a/src/commands/service/create-revision.ts +++ b/src/commands/service/create-revision.ts @@ -8,6 +8,7 @@ import { safeGitUrlForLogging } from "../../lib/gitutils"; import { logger } from "../../logger"; +import { IBedrockFile } from "../../types"; export const createServiceRevisionCommandDecorator = ( command: commander.Command @@ -59,43 +60,13 @@ export const createServiceRevisionCommandDecorator = ( // default pull request against initial ring const bedrockConfig = Bedrock(); // Default to the --target-branch for creating a revision; if not specified, fallback to default rings in bedrock.yaml - const defaultRings: string[] = targetBranch - ? [targetBranch] - : Object.entries(bedrockConfig.rings || {}) - .map(([branch, config]) => ({ branch, ...config })) - .filter(ring => !!ring.isDefault) - .map(ring => ring.branch); - if (defaultRings.length === 0) { - throw Error( - `Default branches/rings must either be specified in ${join( - __dirname, - "bedrock.yaml" - )} or provided via --target-branch` - ); - } - logger.info( - `Creating pull request against branches: ${defaultRings.join(", ")}` + const defaultRings: string[] = getDefaultRings( + targetBranch, + bedrockConfig ); // default pull request source branch to the current branch - if ( - typeof sourceBranch !== "string" || - (typeof sourceBranch === "string" && sourceBranch.length === 0) - ) { - // Parse the source branch from options - // If it does not exist, parse from the git client - logger.info( - `No source-branch provided, parsing the current branch for git client` - ); - sourceBranch = await getCurrentBranch().then(branch => { - if (branch.length === 0) { - throw Error( - `Zero length branch string parsed from git client; cannot automate PR` - ); - } - return branch; - }); - } + sourceBranch = await getSourceBranch(sourceBranch); // Make sure the user isn't trying to make a PR for a branch against itself if (defaultRings.includes(sourceBranch)) { @@ -122,54 +93,121 @@ export const createServiceRevisionCommandDecorator = ( logger.info(`Parsed remote-url for origin: ${safeLoggingUrl}`); } - //////////////////////////////////////////////////////////////////////// - // Type-check data - //////////////////////////////////////////////////////////////////////// - if (typeof description !== "string") { - throw Error( - `--description must be of type 'string', ${typeof description} given.` - ); - } - if (typeof remoteUrl !== "string") { - throw Error( - `--remote-url must be of type 'string', ${typeof remoteUrl} given.` - ); - } - if (typeof sourceBranch !== "string") { - throw Error( - `--source-branch must be of type 'string', ${typeof sourceBranch} given.` - ); - } - if (typeof personalAccessToken !== "string") { - throw Error( - `--personal-access-token must be of type 'string', ${typeof personalAccessToken} given.` - ); - } - if (typeof orgName !== "string") { - throw Error( - `--org-name must be of type 'string', ${typeof orgName} given.` - ); - } - - //////////////////////////////////////////////////////////////////////// - // Main - //////////////////////////////////////////////////////////////////////// - // Make a PR against all default rings - for (const ring of defaultRings) { - if (typeof title !== "string") { - title = `[SPK] ${sourceBranch} => ${ring}`; - logger.info(`--title not set, defaulting to: '${title}'`); - } - await createPullRequest(title, sourceBranch, ring, { - description, - orgName, - originPushUrl: remoteUrl, - personalAccessToken - }); - } + await makePullRequest( + defaultRings, + title, + sourceBranch, + description, + orgName, + remoteUrl, + personalAccessToken + ); } catch (err) { logger.error(err); process.exitCode = 1; } }); }; + +/** + * Gets the default rings + * @param targetBranch Target branch/ring to create a PR against + * @param bedrockConfig The bedrock configuration file + */ +export const getDefaultRings = ( + targetBranch: any, + bedrockConfig: IBedrockFile +): string[] => { + const defaultRings: string[] = targetBranch + ? [targetBranch] + : Object.entries(bedrockConfig.rings || {}) + .map(([branch, config]) => ({ branch, ...config })) + .filter(ring => !!ring.isDefault) + .map(ring => ring.branch); + if (defaultRings.length === 0) { + throw Error( + `Default branches/rings must either be specified in ${join( + __dirname, + "bedrock.yaml" + )} or provided via --target-branch` + ); + } + logger.info( + `Creating pull request against branches: ${defaultRings.join(", ")}` + ); + return defaultRings; +}; + +/** + * Gets the source branch or parses git for the source branch + * @param sourceBranch The source branch + */ +export const getSourceBranch = async (sourceBranch: any): Promise => { + if ( + typeof sourceBranch !== "string" || + (typeof sourceBranch === "string" && sourceBranch.length === 0) + ) { + // Parse the source branch from options + // If it does not exist, parse from the git client + logger.info( + `No source-branch provided, parsing the current branch for git client` + ); + sourceBranch = await getCurrentBranch().then(branch => { + if (branch.length === 0) { + throw Error( + `Zero length branch string parsed from git client; cannot automate PR` + ); + } + return branch; + }); + } + return sourceBranch; +}; + +export const makePullRequest = async ( + defaultRings: string[], + title: any, + sourceBranch: any, + description: any, + orgName: any, + remoteUrl: any, + personalAccessToken: any +) => { + if (typeof description !== "string") { + throw Error( + `--description must be of type 'string', ${typeof description} given.` + ); + } + if (typeof remoteUrl !== "string") { + throw Error( + `--remote-url must be of type 'string', ${typeof remoteUrl} given.` + ); + } + if (typeof sourceBranch !== "string") { + throw Error( + `--source-branch must be of type 'string', ${typeof sourceBranch} given.` + ); + } + if (typeof personalAccessToken !== "string") { + throw Error( + `--personal-access-token must be of type 'string', ${typeof personalAccessToken} given.` + ); + } + if (typeof orgName !== "string") { + throw Error( + `--org-name must be of type 'string', ${typeof orgName} given.` + ); + } + for (const ring of defaultRings) { + if (typeof title !== "string") { + title = `[SPK] ${sourceBranch} => ${ring}`; + logger.info(`--title not set, defaulting to: '${title}'`); + } + await createPullRequest(title, sourceBranch, ring, { + description, + orgName, + originPushUrl: remoteUrl, + personalAccessToken + }); + } +}; From ccc770c29c704bdb763e808d79b198e861425575 Mon Sep 17 00:00:00 2001 From: edaena Date: Mon, 10 Feb 2020 14:31:22 -0800 Subject: [PATCH 02/10] Fix lint errors --- src/commands/service/create-revision.test.ts | 3 +-- src/commands/service/create-revision.ts | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts index 2b226ebdf..dd48114e4 100644 --- a/src/commands/service/create-revision.test.ts +++ b/src/commands/service/create-revision.test.ts @@ -3,15 +3,14 @@ import path from "path"; import shell from "shelljs"; import uuid from "uuid/v4"; import { write } from "../../config"; -import * as gitutils from "../../lib/gitutils"; import * as azure from "../../lib/git/azure"; +import * as gitutils from "../../lib/gitutils"; import { IBedrockFile } from "../../types"; import { getDefaultRings, getSourceBranch, makePullRequest } from "./create-revision"; -import { logger } from "@azure/keyvault-secrets"; jest .spyOn(gitutils, "getCurrentBranch") diff --git a/src/commands/service/create-revision.ts b/src/commands/service/create-revision.ts index e856b7644..c7ed362c6 100644 --- a/src/commands/service/create-revision.ts +++ b/src/commands/service/create-revision.ts @@ -52,7 +52,8 @@ export const createServiceRevisionCommandDecorator = ( personalAccessToken = azure_devops && azure_devops.access_token, targetBranch } = opts; - let { description, remoteUrl, sourceBranch, title } = opts; + let { description, remoteUrl, sourceBranch } = opts; + const title = opts.title; //////////////////////////////////////////////////////////////////////// // Give defaults From b6bf5fa83ba238c5da3c56723e155bf2a2d6869a Mon Sep 17 00:00:00 2001 From: edaena Date: Mon, 10 Feb 2020 14:34:58 -0800 Subject: [PATCH 03/10] Add function documentation --- src/commands/service/create-revision.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/commands/service/create-revision.ts b/src/commands/service/create-revision.ts index c7ed362c6..8dd892c63 100644 --- a/src/commands/service/create-revision.ts +++ b/src/commands/service/create-revision.ts @@ -165,6 +165,16 @@ export const getSourceBranch = async (sourceBranch: any): Promise => { return sourceBranch; }; +/** + * Creates a pull request from the given source branch + * @param defaultRings List of default rings + * @param title Title of pr + * @param sourceBranch Source branch for pr + * @param description Description for pr + * @param orgName Organization name + * @param remoteUrl Remote url + * @param personalAccessToken Access token + */ export const makePullRequest = async ( defaultRings: string[], title: any, From dd3248d5b383ab725489f219896223d3265fbb53 Mon Sep 17 00:00:00 2001 From: edaena Date: Mon, 10 Feb 2020 18:02:16 -0800 Subject: [PATCH 04/10] Updates based on feedback --- src/commands/service/create-revision.test.ts | 27 +++++++++++------ src/commands/service/create-revision.ts | 32 ++++++++++---------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts index dd48114e4..745c494de 100644 --- a/src/commands/service/create-revision.test.ts +++ b/src/commands/service/create-revision.test.ts @@ -5,6 +5,7 @@ import uuid from "uuid/v4"; import { write } from "../../config"; import * as azure from "../../lib/git/azure"; import * as gitutils from "../../lib/gitutils"; +import { createTempDir } from "../../lib/ioUtil"; import { IBedrockFile } from "../../types"; import { getDefaultRings, @@ -22,8 +23,7 @@ const prSpy = jest describe("Default rings", () => { test("Get multiple default rings", () => { - const randomTmpDir = path.join(os.tmpdir(), uuid()); - shell.mkdir("-p", randomTmpDir); + const randomTmpDir = createTempDir(); const validBedrockYaml: IBedrockFile = { rings: { master: { isDefault: true }, @@ -33,14 +33,18 @@ describe("Default rings", () => { services: { "foo/a": { helm: { - // Missing 'chart' chart: { + chart: "elastic", repository: "some-repo" } - } + }, + k8sBackend: "backendservice", + k8sBackendPort: 1337, + pathPrefix: "servicepath", + pathPrefixMajorVersion: "v1" } } - } as any; + }; write(validBedrockYaml, randomTmpDir); const defaultRings = getDefaultRings(undefined, validBedrockYaml); @@ -50,8 +54,7 @@ describe("Default rings", () => { }); test("No default rings", () => { - const randomTmpDir = path.join(os.tmpdir(), uuid()); - shell.mkdir("-p", randomTmpDir); + const randomTmpDir = createTempDir(); const validBedrockYaml: IBedrockFile = { rings: { master: { isDefault: false }, @@ -61,14 +64,18 @@ describe("Default rings", () => { services: { "foo/a": { helm: { - // Missing 'chart' chart: { + chart: "elastic", repository: "some-repo" } - } + }, + k8sBackend: "backendservice", + k8sBackendPort: 1337, + pathPrefix: "servicepath", + pathPrefixMajorVersion: "v1" } } - } as any; + }; write(validBedrockYaml, randomTmpDir); let hasError = false; diff --git a/src/commands/service/create-revision.ts b/src/commands/service/create-revision.ts index 8dd892c63..92635acf0 100644 --- a/src/commands/service/create-revision.ts +++ b/src/commands/service/create-revision.ts @@ -116,7 +116,7 @@ export const createServiceRevisionCommandDecorator = ( * @param bedrockConfig The bedrock configuration file */ export const getDefaultRings = ( - targetBranch: any, + targetBranch: string | undefined, bedrockConfig: IBedrockFile ): string[] => { const defaultRings: string[] = targetBranch @@ -143,7 +143,9 @@ export const getDefaultRings = ( * Gets the source branch or parses git for the source branch * @param sourceBranch The source branch */ -export const getSourceBranch = async (sourceBranch: any): Promise => { +export const getSourceBranch = async ( + sourceBranch: string | undefined +): Promise => { if ( typeof sourceBranch !== "string" || (typeof sourceBranch === "string" && sourceBranch.length === 0) @@ -153,14 +155,12 @@ export const getSourceBranch = async (sourceBranch: any): Promise => { logger.info( `No source-branch provided, parsing the current branch for git client` ); - sourceBranch = await getCurrentBranch().then(branch => { - if (branch.length === 0) { - throw Error( - `Zero length branch string parsed from git client; cannot automate PR` - ); - } - return branch; - }); + sourceBranch = await getCurrentBranch(); + if (sourceBranch.length === 0) { + throw Error( + `Zero length branch string parsed from git client; cannot automate PR` + ); + } } return sourceBranch; }; @@ -177,12 +177,12 @@ export const getSourceBranch = async (sourceBranch: any): Promise => { */ export const makePullRequest = async ( defaultRings: string[], - title: any, - sourceBranch: any, - description: any, - orgName: any, - remoteUrl: any, - personalAccessToken: any + title: string | undefined, + sourceBranch: string | undefined, + description: string | undefined, + orgName: string | undefined, + remoteUrl: string | undefined, + personalAccessToken: string | undefined ) => { if (typeof description !== "string") { throw Error( From ffb6035320e8ca5ec10cd7ee4a3f3fd7456429ee Mon Sep 17 00:00:00 2001 From: edaena Date: Tue, 11 Feb 2020 15:17:09 -0800 Subject: [PATCH 05/10] Add missing test --- src/commands/service/create-revision.test.ts | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts index 745c494de..25e763926 100644 --- a/src/commands/service/create-revision.test.ts +++ b/src/commands/service/create-revision.test.ts @@ -113,6 +113,34 @@ describe("Source branch", () => { }); describe("Create pull request", () => { + test("invalid parameters", async () => { + const params: any[] = [ + "sourceBranch", + "description", + "orgName", + "remoteUrl", + "token" + ]; + for (const [i, v] of params) { + const tmp = params[i]; + params[i] = undefined; + let hasError = false; + try { + await makePullRequest( + ["master"], + "testTitle", + params[0], + params[1], + params[3], + params[4], + params[5] + ); + } catch (err) { + hasError = true; + } + expect(hasError).toBe(true); + } + }); test("Valid parameters", async () => { await makePullRequest( ["master"], From 8c80fbf3bbd988586be6e67bd291b4ae7d3f1937 Mon Sep 17 00:00:00 2001 From: edaena Date: Wed, 12 Feb 2020 09:38:32 -0800 Subject: [PATCH 06/10] Update test case --- src/commands/service/create-revision.test.ts | 34 +++++++++++--------- src/commands/service/create-revision.ts | 12 ++----- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts index 25e763926..8ae46b4eb 100644 --- a/src/commands/service/create-revision.test.ts +++ b/src/commands/service/create-revision.test.ts @@ -12,6 +12,7 @@ import { getSourceBranch, makePullRequest } from "./create-revision"; +import { logger } from "@azure/identity"; jest .spyOn(gitutils, "getCurrentBranch") @@ -114,26 +115,17 @@ describe("Source branch", () => { describe("Create pull request", () => { test("invalid parameters", async () => { - const params: any[] = [ - "sourceBranch", - "description", - "orgName", - "remoteUrl", - "token" - ]; - for (const [i, v] of params) { - const tmp = params[i]; - params[i] = undefined; + for (const i of Array(4).keys()) { let hasError = false; try { await makePullRequest( ["master"], "testTitle", - params[0], - params[1], - params[3], - params[4], - params[5] + i === 0 ? undefined : "branch", + "description", + i === 1 ? undefined : "org", + i === 2 ? undefined : "url", + i === 3 ? undefined : "token" ); } catch (err) { hasError = true; @@ -153,4 +145,16 @@ describe("Create pull request", () => { ); expect(prSpy).toHaveBeenCalled(); }); + test("Default description", async () => { + await makePullRequest( + ["master"], + "testTitle", + "testBranch", + undefined, + "testOrg", + "testUrl", + "testToken" + ); + expect(prSpy).toHaveBeenCalled(); + }); }); diff --git a/src/commands/service/create-revision.ts b/src/commands/service/create-revision.ts index 0be87ecc3..172c014f3 100644 --- a/src/commands/service/create-revision.ts +++ b/src/commands/service/create-revision.ts @@ -47,12 +47,6 @@ export const commandDecorator = (command: commander.Command): void => { ); } - // Give a default description - if (typeof description !== "string") { - description = `This is automated PR generated via SPK`; - logger.info(`--description not set, defaulting to: '${description}'`); - } - // Default the remote to the git origin if (typeof remoteUrl !== "string") { logger.info( @@ -155,10 +149,10 @@ export const makePullRequest = async ( remoteUrl: string | undefined, personalAccessToken: string | undefined ) => { + // Give a default description if (typeof description !== "string") { - throw Error( - `--description must be of type 'string', ${typeof description} given.` - ); + description = `This is automated PR generated via SPK`; + logger.info(`--description not set, defaulting to: '${description}'`); } if (typeof remoteUrl !== "string") { throw Error( From 58a2149c94d6997154d9d8263a2a116be4a8b470 Mon Sep 17 00:00:00 2001 From: edaena Date: Wed, 12 Feb 2020 14:33:34 -0800 Subject: [PATCH 07/10] Fix lint error --- src/commands/service/create-revision.test.ts | 2 +- src/commands/service/create-revision.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts index 8ae46b4eb..0def605ab 100644 --- a/src/commands/service/create-revision.test.ts +++ b/src/commands/service/create-revision.test.ts @@ -1,3 +1,4 @@ +import { logger } from "@azure/identity"; import os from "os"; import path from "path"; import shell from "shelljs"; @@ -12,7 +13,6 @@ import { getSourceBranch, makePullRequest } from "./create-revision"; -import { logger } from "@azure/identity"; jest .spyOn(gitutils, "getCurrentBranch") diff --git a/src/commands/service/create-revision.ts b/src/commands/service/create-revision.ts index 172c014f3..119a524b8 100644 --- a/src/commands/service/create-revision.ts +++ b/src/commands/service/create-revision.ts @@ -21,7 +21,8 @@ export const commandDecorator = (command: commander.Command): void => { personalAccessToken = azure_devops && azure_devops.access_token, targetBranch } = opts; - let { description, remoteUrl, sourceBranch } = opts; + let { remoteUrl, sourceBranch } = opts; + const description = opts.description; const title = opts.title; //////////////////////////////////////////////////////////////////////// From 38258f2f033e2866c88887618b18b241c859a206 Mon Sep 17 00:00:00 2001 From: edaena Date: Wed, 12 Feb 2020 14:34:56 -0800 Subject: [PATCH 08/10] Remove unused imports --- src/commands/service/create-revision.test.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts index 0def605ab..7d3333d85 100644 --- a/src/commands/service/create-revision.test.ts +++ b/src/commands/service/create-revision.test.ts @@ -1,8 +1,3 @@ -import { logger } from "@azure/identity"; -import os from "os"; -import path from "path"; -import shell from "shelljs"; -import uuid from "uuid/v4"; import { write } from "../../config"; import * as azure from "../../lib/git/azure"; import * as gitutils from "../../lib/gitutils"; From 75002e3e5f032b792c5c93cc5bb27ac2ef6160fc Mon Sep 17 00:00:00 2001 From: edaena Date: Wed, 12 Feb 2020 15:39:58 -0800 Subject: [PATCH 09/10] Add test --- src/commands/service/create-revision.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/commands/service/create-revision.test.ts b/src/commands/service/create-revision.test.ts index 7d3333d85..c5a570c3d 100644 --- a/src/commands/service/create-revision.test.ts +++ b/src/commands/service/create-revision.test.ts @@ -152,4 +152,16 @@ describe("Create pull request", () => { ); expect(prSpy).toHaveBeenCalled(); }); + test("Default title", async () => { + await makePullRequest( + ["master"], + undefined, + "testBranch", + "description", + "testOrg", + "testUrl", + "testToken" + ); + expect(prSpy).toHaveBeenCalled(); + }); }); From f1581e7710a90efe5cebfbb5707ad64ed6809cbb Mon Sep 17 00:00:00 2001 From: edaena Date: Thu, 13 Feb 2020 20:59:18 -0800 Subject: [PATCH 10/10] Edit function return value --- src/commands/service/create-revision.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/service/create-revision.ts b/src/commands/service/create-revision.ts index 119a524b8..6b1a1b32e 100644 --- a/src/commands/service/create-revision.ts +++ b/src/commands/service/create-revision.ts @@ -111,7 +111,7 @@ export const getDefaultRings = ( */ export const getSourceBranch = async ( sourceBranch: string | undefined -): Promise => { +): Promise => { if ( typeof sourceBranch !== "string" || (typeof sourceBranch === "string" && sourceBranch.length === 0)