22const _ = require ( 'lodash' ) ;
33const Command = require ( '../../Command' ) ;
44const installRoot = require ( '../root/install.cmd' ) ;
5- const { downloadProvider } = require ( '../hybrid/helper' ) ;
5+ const { downloadProvider, detectProxy } = require ( '../hybrid/helper' ) ;
66const { Runner, components } = require ( '../../../../binary' ) ;
77
88const installArgoCmd = new Command ( {
@@ -52,16 +52,32 @@ const installArgoCmd = new Command({
5252 . option ( 'kube-namespace' , {
5353 describe : 'Namespace in Kubernetes cluster' ,
5454 } )
55+ . option ( 'kube-manifest-path' , {
56+ describe : 'Path to k8s manifest yaml file' ,
57+ } )
5558 . option ( 'sync-mode' , {
5659 choices : [ 'NONE' , 'SELECT' , 'CONTINUE_SYNC' , 'ONE_TIME_SYNC' ] ,
5760 describe : 'Synchronization mode\nNONE - don\'t synchronize\nSELECT - select applications for synchronization\nCONTINUE_SYNC - continuous synchronization\nONE_TIME_SYNC - synchronize one time' ,
5861 } )
5962 . option ( 'sync-apps' , {
6063 array : true ,
6164 describe : 'Applications to be synchronized' ,
65+ } )
66+ . option ( 'http-proxy' , {
67+ describe : 'http proxy to be used in the runner' ,
68+ } )
69+ . option ( 'https-proxy' , {
70+ describe : 'https proxy to be used in the runner' ,
6271 } ) ,
6372 handler : async ( argv ) => {
64- const { 'kube-config-path' : kubeConfigPath , provider } = argv ;
73+ let {
74+ // eslint-disable-next-line prefer-const
75+ 'kube-config-path' : kubeConfigPath ,
76+ // eslint-disable-next-line prefer-const
77+ provider,
78+ 'http-proxy' : httpProxy ,
79+ 'https-proxy' : httpsProxy ,
80+ } = argv ;
6581
6682 const binLocation = await downloadProvider ( { provider } ) ;
6783 const componentRunner = new Runner ( binLocation ) ;
@@ -75,7 +91,7 @@ const installArgoCmd = new Command({
7591 commands . push ( kubeConfigPath ) ;
7692 }
7793
78- const installOptions = _ . pick ( argv , [ 'git-integration' , 'codefresh-integration' , 'argo-host' , 'argo-token' ,
94+ const installOptions = _ . pick ( argv , [ 'git-integration' , 'codefresh-integration' , 'argo-host' , 'argo-token' , 'kube-manifest-path' ,
7995 'argo-username' , 'argo-password' , 'update' , 'kube-context-name' , 'kube-namespace' , 'sync-mode' , 'sync-apps' ] ) ;
8096
8197 _ . forEach ( installOptions , ( value , key ) => {
@@ -90,6 +106,21 @@ const installArgoCmd = new Command({
90106 }
91107 } ) ;
92108
109+ const detectedProxyVars = detectProxy ( ) ;
110+ httpProxy = httpProxy || detectedProxyVars . httpProxy ;
111+ httpsProxy = httpsProxy || detectedProxyVars . httpsProxy ;
112+
113+ if ( httpProxy ) {
114+ commands . push ( '--http-proxy' ) ;
115+ commands . push ( httpProxy ) ;
116+ }
117+
118+ if ( httpsProxy ) {
119+ commands . push ( '--https-proxy' ) ;
120+ commands . push ( httpsProxy ) ;
121+ }
122+
123+
93124 await componentRunner . run ( components . gitops [ provider ] , commands ) ;
94125 } ,
95126} ) ;
0 commit comments