11/* eslint-disable max-len */
2+ const _ = require ( 'lodash' ) ;
23const Command = require ( '../../Command' ) ;
34const installRoot = require ( '../root/install.cmd' ) ;
45const { downloadProvider } = require ( '../hybrid/helper' ) ;
@@ -21,8 +22,43 @@ const installArgoCmd = new Command({
2122 choices : [ 'argocd-agent' ] ,
2223 required : true ,
2324 } )
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+ } )
2446 . option ( 'kube-config-path' , {
2547 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' ,
2662 } ) ,
2763 handler : async ( argv ) => {
2864 const { 'kube-config-path' : kubeConfigPath , provider } = argv ;
@@ -39,6 +75,21 @@ const installArgoCmd = new Command({
3975 commands . push ( kubeConfigPath ) ;
4076 }
4177
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+
4293 await componentRunner . run ( components . gitops [ provider ] , commands ) ;
4394 } ,
4495} ) ;
0 commit comments