From 5fca5b180169befc5357403d00ab9d61495acf6b Mon Sep 17 00:00:00 2001 From: Erick Luiz Bertolini Date: Sat, 10 Feb 2024 10:55:16 -0300 Subject: [PATCH 1/2] feature:CI/CD pipeline support --- src/commands/deploy.ts | 12 ++++++++---- src/modules/newDeploy.ts | 11 ++++++++--- src/modules/oldDeploy.ts | 6 ++++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index fad3ffe..ed26457 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -19,6 +19,10 @@ export default class Deploy extends CustomCommand { static flags = { ...CustomCommand.globalFlags, + pipeline: oclifFlags.boolean({ + char: 'p', + description: 'Deploys the app in pipeline mode.', + }), yes: oclifFlags.boolean({ char: 'y', description: 'Answers yes to all prompts.' }), force: oclifFlags.boolean({ char: 'f', @@ -44,17 +48,17 @@ export default class Deploy extends CustomCommand { if (featureFlags.FEATURE_FLAG_DEPLOY_PLUGIN) { const { args: { appId }, - flags: { yes, force }, + flags: { yes, force, pipeline }, } = this.parse(Deploy) - await newAppsDeploy(appId, { yes, force }) + await newAppsDeploy(appId, { yes, force }, pipeline) } else { const { args: { appId }, - flags: { yes }, + flags: { yes, pipeline }, } = this.parse(Deploy) - await oldAppsDeploy(appId, { yes }) + await oldAppsDeploy(appId, { yes }, pipeline) } } } diff --git a/src/modules/newDeploy.ts b/src/modules/newDeploy.ts index f5c148b..4515d10 100644 --- a/src/modules/newDeploy.ts +++ b/src/modules/newDeploy.ts @@ -27,6 +27,7 @@ const switchToVendorMessage = (vendor: string): string => { } const promptDeploy = (app: string) => promptConfirm(`Are you sure you want to deploy app ${app}`) + const promptDeployForce = () => promptConfirm(`Are you sure you want to ignore the minimum testing period of 7 minutes after publish?`) @@ -90,18 +91,22 @@ const prepareDeploy = async (app, originalAccount, originalWorkspace: string, fo } // @ts-ignore -export default async (optionalApp: string, options) => { +export default async (optionalApp: string, options, pipeline: boolean) => { const preConfirm = options.y || options.yes const force = options.f || options.force || false const { account: originalAccount, workspace: originalWorkspace } = SessionManager.getSingleton() const app = optionalApp || (await ManifestEditor.getManifestEditor()).appLocator - if (!preConfirm && !(await promptDeploy(app))) { + if (!pipeline && !preConfirm && !(await promptDeploy(app))) { return } - if (force && !(await promptDeployForce())) { + if (pipeline) { + logger.info(`Deploying app ${app} in pipeline mode`) + } + + if (!pipeline && force && !(await promptDeployForce())) { return } diff --git a/src/modules/oldDeploy.ts b/src/modules/oldDeploy.ts index 95876c5..cc27621 100644 --- a/src/modules/oldDeploy.ts +++ b/src/modules/oldDeploy.ts @@ -70,16 +70,18 @@ const prepareDeploy = async (app, originalAccount, originalWorkspace: string): P } // @ts-ignore -export default async (optionalApp: string, options) => { +export default async (optionalApp: string, options, pipeline) => { const preConfirm = options.y || options.yes const { account: originalAccount, workspace: originalWorkspace } = SessionManager.getSingleton() const app = optionalApp || (await ManifestEditor.getManifestEditor()).appLocator - if (!preConfirm && !(await promptDeploy(app))) { + if (!pipeline && !preConfirm && !(await promptDeploy(app))) { return } + logger.info('Deploying app in pipeline mode') + logger.debug(`Deploying app ${app}`) return prepareDeploy(app, originalAccount, originalWorkspace) From c437f5b639ccf959f5a50a9059d31f51f3ca6257 Mon Sep 17 00:00:00 2001 From: Erick Luiz Bertolini Date: Sat, 10 Feb 2024 10:56:25 -0300 Subject: [PATCH 2/2] feature:CI/CD pipeline support --- src/modules/oldDeploy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/oldDeploy.ts b/src/modules/oldDeploy.ts index cc27621..d2321c8 100644 --- a/src/modules/oldDeploy.ts +++ b/src/modules/oldDeploy.ts @@ -80,7 +80,9 @@ export default async (optionalApp: string, options, pipeline) => { return } - logger.info('Deploying app in pipeline mode') + if (pipeline) { + logger.info('Deploying app in pipeline mode') + } logger.debug(`Deploying app ${app}`)