Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)
}
}
}
11 changes: 8 additions & 3 deletions src/modules/newDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?`)

Expand Down Expand Up @@ -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
}

Expand Down
8 changes: 6 additions & 2 deletions src/modules/oldDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,20 @@ 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
}

if (pipeline) {
logger.info('Deploying app in pipeline mode')
}

logger.debug(`Deploying app ${app}`)

return prepareDeploy(app, originalAccount, originalWorkspace)
Expand Down