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({
83
83
if ( ! kubeContextName ) {
84
84
kubeContextName = getKubeContext ( kubeConfigPath ) ;
85
85
}
86
+ if ( ! kubeNamespace ) {
87
+ throw new Error ( 'kube-namespace is mandatory parameter' ) ;
88
+ }
86
89
87
90
if ( ! token ) { // Create an agent if not provided
88
91
name = name || `${ kubeContextName } _${ kubeNamespace } ` ;
Original file line number Diff line number Diff line change @@ -6,11 +6,18 @@ const ProgressEvents = require('../../helpers/progressEvents');
6
6
const cliProgress = require ( 'cli-progress' ) ;
7
7
8
8
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
+ }
10
17
const runtimes = _ . get ( agent , 'runtimes' , [ ] ) ;
11
- const existingRT = _ . find ( runtimes , value => value === runtime ) ;
18
+ const existingRT = _ . find ( runtimes , value => value === name ) ;
12
19
if ( ! existingRT ) {
13
- runtimes . push ( runtime ) ;
20
+ runtimes . push ( name ) ;
14
21
await sdk . agents . update ( { agentId : agent . id , runtimes } ) ;
15
22
}
16
23
} ;
@@ -90,6 +97,9 @@ const attachRuntimeCmd = new Command({
90
97
if ( agent === '' || ! agent ) {
91
98
throw new Error ( 'agent was not found' ) ;
92
99
}
100
+ if ( ! kubeNamespace ) {
101
+ throw new Error ( 'runtime-kube-namespace is mandatory parameter' ) ;
102
+ }
93
103
94
104
await attachAgentToRuntime ( agent , runtimeName ) ;
95
105
Original file line number Diff line number Diff line change @@ -117,6 +117,11 @@ const installRuntimeCmd = new Command({
117
117
'agent-kube-config-path' : agentKubeConfigPath ,
118
118
token,
119
119
} = argv ;
120
+
121
+ if ( ! kubeNamespace ) {
122
+ throw new Error ( 'runtime-kube-namespace is mandatory parameter' ) ;
123
+ }
124
+
120
125
const apiHost = sdk . config . context . url ;
121
126
const clusterName = kubeContextName || getKubeContext ( kubeConfigPath ) ;
122
127
const runtimeName = `${ clusterName } /${ kubeNamespace } ` ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " codefresh" ,
3
- "version" : " 0.43.9 " ,
3
+ "version" : " 0.43.10 " ,
4
4
5
5
"description" : " Codefresh command line utility" ,
6
6
"main" : " index.js" ,
You can’t perform that action at this time.
0 commit comments