@forge/cli

13.3.0-next.12-experimental-4b981ef-experimental-5b8eb3c13.3.0-next.25
out/command-line/controller/deploy-controller.js
~out/command-line/controller/deploy-controller.jsModified
+34−19
Index: package/out/command-line/controller/deploy-controller.js
===================================================================
--- package/out/command-line/controller/deploy-controller.js
+++ package/out/command-line/controller/deploy-controller.js
@@ -103,17 +103,26 @@
             return { proceed, connectKeyChanged: proceed, connectKeyDeleted: false };
         }
         return { proceed: true, connectKeyChanged: false, connectKeyDeleted: false };
     }
-    async verifyPreDeployment(environment) {
+    async verifyPreDeployment(environment, options) {
         this.deployView.displayLintRunning();
-        const { lintResults } = await this.lintService.run(environment, { fix: false }, this.deployView.getLogger());
+        const { lintResults } = await this.lintService.run(environment, { fix: false, ...options, linterMode: options.buildTag ? 'server-side' : 'both' }, this.deployView.getLogger());
         const problemCount = this.lintService.problemCount(lintResults);
-        if (problemCount.errors) {
+        if (problemCount.errors && problemCount.approvals) {
+            this.deployView.displayLintErrorsWithApprovals(lintResults);
+            const failures = this.lintService.failedScopes(lintResults);
+            throw new DeployLintFailureError(failures);
+        }
+        else if (problemCount.errors) {
             this.deployView.displayLintErrors(lintResults);
             const failures = this.lintService.failedScopes(lintResults);
             throw new DeployLintFailureError(failures);
         }
+        else if (problemCount.approvals) {
+            this.deployView.displayLintApprovals(lintResults.filter((r) => r.approvals.length));
+            throw new DeployLintFailureError([]);
+        }
         else if (problemCount.warnings) {
             this.deployView.displayLintWarnings(problemCount.warnings);
         }
         else {
@@ -202,30 +211,36 @@
             await this.confirmAndCreateEnvironment(environment, nonInteractive);
             return this.appEnvironmentClient.getAppEnvironmentDetails(id, environment);
         }
     }
-    async run({ environment, verify, nonInteractive, majorVersion, buildTag, skipRollout }) {
+    async run({ environment, verify, nonInteractive, majorVersion, buildTag, skipRollout, approveRules }) {
         const { id } = await this.appConfigProvider();
         const appDetails = await this.getAppEnvironmentDetails(id, environment, nonInteractive);
         appDetails.buildTag = buildTag;
         this.deployView.displayStart(environment, appDetails.environmentType, buildTag);
         await this.devSpaceService.displayEnforcementWarningsIfNeeded(this.deployView.getLogger(), id, 'deploy');
         let hasConnectKeyChanged = false;
         let hasConnectKeyDeleted = false;
-        if (verify && !buildTag) {
-            await this.verifyPreDeployment(environment);
-            const keys = await this.migrationKeysService.getMigrationKeysForAppEnvironment(environment);
-            const { proceed, connectKeyChanged, connectKeyDeleted } = await this.validateConnectKeyChange(environment, keys);
-            if (!proceed) {
-                return;
-            }
-            hasConnectKeyChanged = connectKeyChanged;
-            hasConnectKeyDeleted = connectKeyDeleted;
-            if (majorVersion) {
-                this.deployView.displayDeployPreviousMajorVersionWarning(majorVersion);
-                if (!nonInteractive) {
-                    if (!(await this.deployView.promptToDeployPreviousMajorVersion())) {
-                        return;
+        if (verify) {
+            await this.verifyPreDeployment(environment, {
+                approveRules,
+                buildTag,
+                majorVersion
+            });
+            if (!buildTag) {
+                const keys = await this.migrationKeysService.getMigrationKeysForAppEnvironment(environment);
+                const { proceed, connectKeyChanged, connectKeyDeleted } = await this.validateConnectKeyChange(environment, keys);
+                if (!proceed) {
+                    return;
+                }
+                hasConnectKeyChanged = connectKeyChanged;
+                hasConnectKeyDeleted = connectKeyDeleted;
+                if (majorVersion) {
+                    this.deployView.displayDeployPreviousMajorVersionWarning(majorVersion);
+                    if (!nonInteractive) {
+                        if (!(await this.deployView.promptToDeployPreviousMajorVersion())) {
+                            return;
+                        }
                     }
                 }
             }
         }
@@ -253,9 +268,9 @@
             modules: config.modules,
             i18nConfig: config.translations,
             buildTag,
             skipRollout
-        }));
+        }), approveRules);
         if (verify) {
             await this.verifyPostDeployment(environment, appDetails.environmentType, majorVersion);
         }
         try {