File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed
lib/interface/cli/commands Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ const installAgentCmd = new Command({
8383 if ( ! kubeContextName ) {
8484 kubeContextName = getKubeContext ( kubeConfigPath ) ;
8585 }
86+ if ( ! kubeNamespace ) {
87+ throw new Error ( 'kube-namespace is mandatory parameter' ) ;
88+ }
8689
8790 if ( ! token ) { // Create an agent if not provided
8891 name = name || `${ kubeContextName } _${ kubeNamespace } ` ;
Original file line number Diff line number Diff line change @@ -6,11 +6,18 @@ const ProgressEvents = require('../../helpers/progressEvents');
66const cliProgress = require ( 'cli-progress' ) ;
77
88
9- const attachAgentToRuntime = async ( agent , runtime ) => {
9+ const attachAgentToRuntime = async ( agent , name ) => {
10+ const rt = await sdk . runtimeEnvs . get ( { name } ) ;
11+ if ( ! rt ) {
12+ throw new Error ( `runtime ${ name } does not exist on the account` ) ;
13+ }
14+ if ( ! rt . metadata . agent ) {
15+ throw new Error ( 'cannot attach non hybrid runtime' ) ;
16+ }
1017 const runtimes = _ . get ( agent , 'runtimes' , [ ] ) ;
11- const existingRT = _ . find ( runtimes , value => value === runtime ) ;
18+ const existingRT = _ . find ( runtimes , value => value === name ) ;
1219 if ( ! existingRT ) {
13- runtimes . push ( runtime ) ;
20+ runtimes . push ( name ) ;
1421 await sdk . agents . update ( { agentId : agent . id , runtimes } ) ;
1522 }
1623} ;
@@ -90,6 +97,9 @@ const attachRuntimeCmd = new Command({
9097 if ( agent === '' || ! agent ) {
9198 throw new Error ( 'agent was not found' ) ;
9299 }
100+ if ( ! kubeNamespace ) {
101+ throw new Error ( 'runtime-kube-namespace is mandatory parameter' ) ;
102+ }
93103
94104 await attachAgentToRuntime ( agent , runtimeName ) ;
95105
Original file line number Diff line number Diff line change @@ -117,6 +117,11 @@ const installRuntimeCmd = new Command({
117117 'agent-kube-config-path' : agentKubeConfigPath ,
118118 token,
119119 } = argv ;
120+
121+ if ( ! kubeNamespace ) {
122+ throw new Error ( 'runtime-kube-namespace is mandatory parameter' ) ;
123+ }
124+
120125 const apiHost = sdk . config . context . url ;
121126 const clusterName = kubeContextName || getKubeContext ( kubeConfigPath ) ;
122127 const runtimeName = `${ clusterName } /${ kubeNamespace } ` ;
Original file line number Diff line number Diff line change 11{
22 "name" : " codefresh" ,
3- "version" : " 0.43.9 " ,
3+ "version" : " 0.43.10 " ,
44
55 "description" : " Codefresh command line utility" ,
66 "main" : " index.js" ,
You can’t perform that action at this time.
0 commit comments