1
1
/* eslint-disable max-len */
2
+ const _ = require ( 'lodash' ) ;
2
3
const Command = require ( '../../Command' ) ;
3
4
const installRoot = require ( '../root/install.cmd' ) ;
4
5
const { downloadProvider } = require ( '../hybrid/helper' ) ;
@@ -21,8 +22,43 @@ const installArgoCmd = new Command({
21
22
choices : [ 'argocd-agent' ] ,
22
23
required : true ,
23
24
} )
25
+ . option ( 'git-integration' , {
26
+ describe : 'Name of git integration in Codefresh' ,
27
+ } )
28
+ . option ( 'codefresh-integration' , {
29
+ describe : 'Name of argocd integration in Codefresh' ,
30
+ } )
31
+ . option ( 'argo-host' , {
32
+ describe : 'Host of argocd installation' ,
33
+ } )
34
+ . option ( 'argo-token' , {
35
+ describe : 'Token of argocd installation. Preferred auth method' ,
36
+ } )
37
+ . option ( 'argo-username' , {
38
+ describe : 'Username of argocd installation. Should be used with argo-password' ,
39
+ } )
40
+ . option ( 'argo-password' , {
41
+ describe : 'Username of argocd installation. Should be used with argo-username' ,
42
+ } )
43
+ . option ( 'update' , {
44
+ describe : 'Update argocd integration if exists' ,
45
+ } )
24
46
. option ( 'kube-config-path' , {
25
47
describe : 'Path to kubeconfig file (default is $HOME/.kube/config)' ,
48
+ } )
49
+ . option ( 'kube-context-name' , {
50
+ describe : 'Name of Kubernetes context' ,
51
+ } )
52
+ . option ( 'kube-namespace' , {
53
+ describe : 'Namespace in Kubernetes cluster' ,
54
+ } )
55
+ . option ( 'sync-mode' , {
56
+ choices : [ 'NONE' , 'SELECT' , 'CONTINUE_SYNC' , 'ONE_TIME_SYNC' ] ,
57
+ describe : 'Synchronization mode\nNONE - don\'t synchronize\nSELECT - select applications for synchronization\nCONTINUE_SYNC - continuous synchronization\nONE_TIME_SYNC - synchronize one time' ,
58
+ } )
59
+ . option ( 'sync-apps' , {
60
+ array : true ,
61
+ describe : 'Applications to be synchronized' ,
26
62
} ) ,
27
63
handler : async ( argv ) => {
28
64
const { 'kube-config-path' : kubeConfigPath , provider } = argv ;
@@ -39,6 +75,21 @@ const installArgoCmd = new Command({
39
75
commands . push ( kubeConfigPath ) ;
40
76
}
41
77
78
+ const installOptions = _ . pick ( argv , [ 'git-integration' , 'codefresh-integration' , 'argo-host' , 'argo-token' ,
79
+ 'argo-username' , 'argo-password' , 'update' , 'kube-context-name' , 'kube-namespace' , 'sync-mode' , 'sync-apps' ] ) ;
80
+
81
+ _ . forEach ( installOptions , ( value , key ) => {
82
+ if ( _ . isArray ( value ) ) {
83
+ value . forEach ( ( item ) => {
84
+ commands . push ( `--${ key } ` ) ;
85
+ commands . push ( item ) ;
86
+ } ) ;
87
+ } else {
88
+ commands . push ( `--${ key } ` ) ;
89
+ if ( value !== true ) commands . push ( value ) ;
90
+ }
91
+ } ) ;
92
+
42
93
await componentRunner . run ( components . gitops [ provider ] , commands ) ;
43
94
} ,
44
95
} ) ;
0 commit comments