File tree Expand file tree Collapse file tree 4 files changed +86
-3
lines changed
interface/cli/commands/pipeline/dynamic Expand file tree Collapse file tree 4 files changed +86
-3
lines changed Original file line number Diff line number Diff line change 3
3
installChart,
4
4
} = require ( './../../../../../logic/api/helm' ) ;
5
5
const { printError } = require ( './../../../helpers/general' ) ;
6
+ const { log } = require ( '../../../../../logic' ) . api ;
6
7
7
8
const install = new Command ( {
8
9
root : true ,
@@ -62,6 +63,8 @@ const install = new Command({
62
63
tillerNamespace : argv . tillerNamespace ,
63
64
} ) ;
64
65
console . log ( `Started with id: ${ workflowId } ` ) ;
66
+ log . showWorkflowLogs ( workflowId , true ) ;
67
+ process . exit ( 0 ) ;
65
68
} catch ( err ) {
66
69
printError ( err ) ;
67
70
process . exit ( 1 ) ;
Original file line number Diff line number Diff line change
1
+ const Command = require ( '../../../Command' ) ;
2
+ const {
3
+ testRelease,
4
+ } = require ( './../../../../../logic/api/helm' ) ;
5
+ const { printError } = require ( './../../../helpers/general' ) ;
6
+ const { log } = require ( '../../../../../logic' ) . api ;
7
+
8
+ const install = new Command ( {
9
+ root : true ,
10
+ command : 'test-release [name]' ,
11
+ description : 'Test helm releaes' ,
12
+ builder : ( yargs ) => {
13
+ return yargs
14
+ . usage ( 'Test helm relaese' )
15
+ . option ( 'cluster' , {
16
+ description : 'Install on cluster' ,
17
+ type : 'string' ,
18
+ required : true ,
19
+ } )
20
+ . option ( 'timeout' , {
21
+ description : 'time in seconds to wait for any individual kubernetes operation (like Jobs for hooks) (default 300)' ,
22
+ default : '300' ,
23
+ type : 'number' ,
24
+ } )
25
+ . option ( 'cleanup' , {
26
+ description : 'delete test pods upon completion (default false)' ,
27
+ default : 'false' ,
28
+ type : 'boolean' ,
29
+ } ) ;
30
+ } ,
31
+ handler : async ( argv ) => {
32
+ const releaseName = argv . name ;
33
+ if ( ! releaseName ) {
34
+ throw new Error ( 'Release name is required' ) ;
35
+ }
36
+ try {
37
+ const workflowId = await testRelease ( {
38
+ releaseName,
39
+ cluster : argv . cluster ,
40
+ cleanup : argv . cleanup ,
41
+ timeout : argv . timeout ,
42
+ } ) ;
43
+ console . log ( `Started with id: ${ workflowId } ` ) ;
44
+ await log . showWorkflowLogs ( workflowId , true ) ;
45
+ process . exit ( 0 ) ;
46
+ } catch ( err ) {
47
+ printError ( err ) ;
48
+ process . exit ( 1 ) ;
49
+ }
50
+ } ,
51
+ } ) ;
52
+
53
+ module . exports = install ;
Original file line number Diff line number Diff line change 1
1
const Promise = require ( 'bluebird' ) ;
2
2
const _ = require ( 'lodash' ) ;
3
3
const CFError = require ( 'cf-errors' ) ; // eslint-disable-line
4
- const { sendHttpRequest } = require ( './helper' ) ;
5
- const { getContextByName } = require ( './context' ) ;
4
+ const {
5
+ sendHttpRequest,
6
+ } = require ( './helper' ) ;
7
+ const {
8
+ getContextByName,
9
+ } = require ( './context' ) ;
6
10
7
11
const SUPPORTED_TYPES = [
8
12
'yaml' ,
@@ -65,6 +69,29 @@ const installChart = async ({
65
69
return res . id ;
66
70
} ;
67
71
72
+ const testRelease = async ( {
73
+ releaseName,
74
+ cluster,
75
+ cleanup,
76
+ timeout,
77
+ } ) => {
78
+ const options = {
79
+ url : `/api/kubernetes/release/test/${ releaseName } ` ,
80
+ method : 'POST' ,
81
+ qs : {
82
+ selector : cluster ,
83
+ } ,
84
+ body : {
85
+ cleanup,
86
+ timeout,
87
+ } ,
88
+ } ;
89
+
90
+ const res = await sendHttpRequest ( options ) ;
91
+ return res . id ;
92
+ } ;
93
+
68
94
module . exports = {
69
95
installChart,
96
+ testRelease,
70
97
} ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " codefresh" ,
3
- "version" : " 0.6.91 " ,
3
+ "version" : " 0.7.0 " ,
4
4
"description" : " Codefresh command line utility" ,
5
5
"main" : " index.js" ,
6
6
"preferGlobal" : true ,
You can’t perform that action at this time.
0 commit comments