2
2
const _ = require ( 'lodash' ) ;
3
3
const Command = require ( '../../Command' ) ;
4
4
const installRoot = require ( '../root/install.cmd' ) ;
5
- const { downloadProvider } = require ( '../hybrid/helper' ) ;
5
+ const { downloadProvider, detectProxy } = require ( '../hybrid/helper' ) ;
6
6
const { Runner, components } = require ( '../../../../binary' ) ;
7
7
8
8
const installArgoCmd = new Command ( {
@@ -52,16 +52,32 @@ const installArgoCmd = new Command({
52
52
. option ( 'kube-namespace' , {
53
53
describe : 'Namespace in Kubernetes cluster' ,
54
54
} )
55
+ . option ( 'kube-manifest-path' , {
56
+ describe : 'Path to k8s manifest yaml file' ,
57
+ } )
55
58
. option ( 'sync-mode' , {
56
59
choices : [ 'NONE' , 'SELECT' , 'CONTINUE_SYNC' , 'ONE_TIME_SYNC' ] ,
57
60
describe : 'Synchronization mode\nNONE - don\'t synchronize\nSELECT - select applications for synchronization\nCONTINUE_SYNC - continuous synchronization\nONE_TIME_SYNC - synchronize one time' ,
58
61
} )
59
62
. option ( 'sync-apps' , {
60
63
array : true ,
61
64
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' ,
62
71
} ) ,
63
72
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 ;
65
81
66
82
const binLocation = await downloadProvider ( { provider } ) ;
67
83
const componentRunner = new Runner ( binLocation ) ;
@@ -75,7 +91,7 @@ const installArgoCmd = new Command({
75
91
commands . push ( kubeConfigPath ) ;
76
92
}
77
93
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' ,
79
95
'argo-username' , 'argo-password' , 'update' , 'kube-context-name' , 'kube-namespace' , 'sync-mode' , 'sync-apps' ] ) ;
80
96
81
97
_ . forEach ( installOptions , ( value , key ) => {
@@ -90,6 +106,21 @@ const installArgoCmd = new Command({
90
106
}
91
107
} ) ;
92
108
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
+
93
124
await componentRunner . run ( components . gitops [ provider ] , commands ) ;
94
125
} ,
95
126
} ) ;
0 commit comments