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 33 installChart,
44} = require ( './../../../../../logic/api/helm' ) ;
55const { printError } = require ( './../../../helpers/general' ) ;
6+ const { log } = require ( '../../../../../logic' ) . api ;
67
78const install = new Command ( {
89 root : true ,
@@ -62,6 +63,8 @@ const install = new Command({
6263 tillerNamespace : argv . tillerNamespace ,
6364 } ) ;
6465 console . log ( `Started with id: ${ workflowId } ` ) ;
66+ log . showWorkflowLogs ( workflowId , true ) ;
67+ process . exit ( 0 ) ;
6568 } catch ( err ) {
6669 printError ( err ) ;
6770 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 11const Promise = require ( 'bluebird' ) ;
22const _ = require ( 'lodash' ) ;
33const 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' ) ;
610
711const SUPPORTED_TYPES = [
812 'yaml' ,
@@ -65,6 +69,29 @@ const installChart = async ({
6569 return res . id ;
6670} ;
6771
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+
6894module . exports = {
6995 installChart,
96+ testRelease,
7097} ;
Original file line number Diff line number Diff line change 11{
22 "name" : " codefresh" ,
3- "version" : " 0.6.91 " ,
3+ "version" : " 0.7.0 " ,
44 "description" : " Codefresh command line utility" ,
55 "main" : " index.js" ,
66 "preferGlobal" : true ,
You can’t perform that action at this time.
0 commit comments