File tree Expand file tree Collapse file tree 13 files changed +97
-33
lines changed Expand file tree Collapse file tree 13 files changed +97
-33
lines changed Original file line number Diff line number Diff line change 11const docs = require ( '../docs' ) ;
22
33describe ( 'docs generation' , ( ) => {
4+ jest . setTimeout ( 10000 ) ;
45 it ( 'should generate docs' , async ( ) => {
56 await docs ( ) ;
67 } ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ promoteCmd = promoteCmd.toCommand();
99
1010jest . mock ( '../../../helpers/helm' ) ;
1111jest . mock ( '../../../helpers/workflow' ) ;
12+ jest . spyOn ( process , 'exit' ) . mockImplementation ( ) ;
1213
1314const request = require ( 'requestretry' ) ;
1415
Original file line number Diff line number Diff line change @@ -91,7 +91,8 @@ const install = new Command({
9191 console . log ( workflowId ) ;
9292 return ;
9393 }
94- await followLogs ( workflowId ) ;
94+ const exitCode = await followLogs ( workflowId ) ;
95+ process . exit ( exitCode ) ;
9596 } catch ( err ) {
9697 Output . printError ( err ) ;
9798 process . exit ( 1 ) ;
Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ const promote = new Command({
105105 console . log ( workflowId ) ;
106106 return ;
107107 }
108- await followLogs ( workflowId ) ;
108+ const exitCode = await followLogs ( workflowId ) ;
109+ process . exit ( exitCode ) ;
109110 } catch ( err ) {
110111 Output . printError ( err ) ;
111112 process . exit ( 1 ) ;
Original file line number Diff line number Diff line change @@ -80,7 +80,8 @@ const install = new Command({
8080 console . log ( workflowId ) ;
8181 return ;
8282 }
83- await followLogs ( workflowId ) ;
83+ const exitCode = await followLogs ( workflowId ) ;
84+ process . exit ( exitCode ) ;
8485 } catch ( err ) {
8586 Output . printError ( err ) ;
8687 process . exit ( 1 ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ testCmd = testCmd.toCommand();
99
1010jest . mock ( '../../../helpers/helm' ) ;
1111jest . mock ( '../../../helpers/workflow' ) ;
12+ jest . spyOn ( process , 'exit' ) . mockImplementation ( ) ;
1213
1314const request = require ( 'requestretry' ) ;
1415
Original file line number Diff line number Diff line change @@ -63,7 +63,8 @@ const install = new Command({
6363 console . log ( workflowId ) ;
6464 return ;
6565 }
66- await followLogs ( workflowId ) ;
66+ const exitCode = await followLogs ( workflowId ) ;
67+ process . exit ( exitCode ) ;
6768 } catch ( err ) {
6869 Output . printError ( err ) ;
6970 process . exit ( 1 ) ;
Original file line number Diff line number Diff line change 11const RunBaseCommand = require ( './run.base' ) ;
22const { sdk } = require ( '../../../../logic' ) ;
3- const Workflow = require ( '../../../../logic/entities/Workflow ' ) ;
3+ const { followLogs } = require ( '../../helpers/workflow ' ) ;
44
55function _buildBody ( data ) {
66 const body = {
@@ -50,22 +50,9 @@ class RunExternalCommand extends RunBaseCommand {
5050 console . log ( this . workflowId ) ;
5151 return 0 ;
5252 }
53- await sdk . logs . showWorkflowLogs ( this . workflowId , true ) ;
54- const buildResponse = await sdk . workflows . get ( { id : this . workflowId } ) ;
55- const workflowInstance = Workflow . fromResponse ( buildResponse ) ;
56- switch ( workflowInstance . getStatus ( ) ) {
57- case 'success' :
58- return 0 ;
59- case 'error' :
60- return 1 ;
61- case 'terminated' :
62- return 2 ;
63- default :
64- return 100 ;
65- }
66- } else {
67- console . log ( this . workflowId ) ;
53+ return followLogs ( this . workflowId ) ;
6854 }
55+ console . log ( this . workflowId ) ;
6956 }
7057}
7158
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const path = require('path');
55const DEFAULTS = require ( '../../defaults' ) ;
66const _ = require ( 'lodash' ) ;
77const { sdk } = require ( '../../../../logic' ) ;
8+ const { followLogs } = require ( '../../helpers/workflow' ) ;
89const chalk = require ( 'chalk' ) ;
910
1011const regex = / # # [ 0 - 9 a - f ] { 24 } # # / i;
@@ -151,8 +152,7 @@ class RunLocalCommand extends RunBaseCommand {
151152 const include = line . match ( regex ) ;
152153 if ( include ) {
153154 const workflowId = include [ 0 ] . substring ( 2 , include [ 0 ] . length - 2 ) ;
154- sdk . logs . showWorkflowLogs ( workflowId , true )
155- . then ( ( ) => resolve ( 0 ) ) ;
155+ followLogs ( workflowId ) . then ( resolve ) ;
156156 }
157157 } ) ;
158158 stream . on ( 'error' , ( err ) => {
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ const restart = new Command({
2929 console . log ( workflowId ) ;
3030 return ;
3131 }
32- await followLogs ( workflowId ) ;
32+ const exitCode = await followLogs ( workflowId ) ;
33+ process . exit ( exitCode ) ;
3334 } ,
3435} ) ;
3536
You can’t perform that action at this time.
0 commit comments