diff --git a/package.json b/package.json index 11b8f1b..c36867e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@subsquid/cli", "description": "squid cli tool", - "version": "3.0.0-beta.5", + "version": "3.0.0-beta.6", "license": "GPL-3.0-or-later", "repository": "git@github.com:subsquid/squid-cli.git", "publishConfig": { diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index a852e2d..bd0b33a 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -227,7 +227,7 @@ export default class Deploy extends DeployCommand { * Squid exists we should check running deploys */ if (target) { - const attached = await this.promptAttachToDeploy(target); + const attached = await this.promptAttachToDeploy(target, { interactive }); if (attached) return; } @@ -235,7 +235,7 @@ export default class Deploy extends DeployCommand { * Squid exists we should ask for update */ if (target && !force) { - const update = await this.promptUpdateSquid(target); + const update = await this.promptUpdateSquid(target, { interactive }); if (!update) return; } @@ -244,7 +244,7 @@ export default class Deploy extends DeployCommand { */ const hasTag = !!target?.tags.find((t) => t.name === addTag) || tag === addTag; if (addTag && !force && !hasTag) { - const add = await this.promptAddTag({ organization, name, tag: addTag }); + const add = await this.promptAddTag({ organization, name, tag: addTag }, { interactive }); if (!add) return; } diff --git a/src/deploy-command.ts b/src/deploy-command.ts index 2179a6c..15a1163 100644 --- a/src/deploy-command.ts +++ b/src/deploy-command.ts @@ -10,10 +10,19 @@ export abstract class DeployCommand extends CliCommand { deploy: Deployment | undefined; logsPrinted = 0; - async promptAttachToDeploy(squid: Squid) { + async promptAttachToDeploy(squid: Squid, { interactive }: { interactive?: boolean } = {}) { if (!squid.lastDeploy) return false; if (squid.status !== 'DEPLOYING') return false; + const warning = `Squid "${formatSquidReference(squid)}" is being deploying. +You can not run deploys on the same squid in parallel`; + + if (!interactive) { + this.error(warning); + } + + this.warn(warning); + switch (squid.lastDeploy.type) { // we should react only for running deploy case 'DEPLOY': @@ -21,9 +30,7 @@ export abstract class DeployCommand extends CliCommand { { name: 'confirm', type: 'confirm', - message: `Squid "${formatSquidReference(squid)}" is being deploying. -You can not run deploys on the same squid in parallel. -Do you want to attach to the running deploy process?`, + message: `Do you want to attach to the running deploy process?`, }, ]); if (!confirm) return false;