@@ -5,6 +5,7 @@ const installRoot = require('../root/install.cmd');
5
5
const { detectProxy } = require ( '../../helpers/general' ) ;
6
6
const { downloadProvider } = require ( '../hybrid/helper' ) ;
7
7
const { Runner, components } = require ( '../../../../binary' ) ;
8
+ const { install : installArgocd } = require ( './install-argocd' ) ;
8
9
9
10
const installArgoCmd = new Command ( {
10
11
root : false ,
@@ -20,7 +21,7 @@ const installArgoCmd = new Command({
20
21
. env ( 'CF_ARG_' )
21
22
. positional ( 'provider' , {
22
23
describe : 'Gitops provider' ,
23
- choices : [ 'argocd-agent' ] ,
24
+ choices : [ 'argocd' , 'argocd -agent'] ,
24
25
required : true ,
25
26
} )
26
27
. option ( 'git-integration' , {
@@ -36,10 +37,11 @@ const installArgoCmd = new Command({
36
37
describe : 'Token of argocd installation. Preferred auth method' ,
37
38
} )
38
39
. option ( 'argo-username' , {
39
- describe : 'Username of argocd installation. Should be used with argo-password' ,
40
+ default : 'admin' ,
41
+ describe : 'Username of existing argocd installation. Should be used with argo-password' ,
40
42
} )
41
43
. option ( 'argo-password' , {
42
- describe : 'Username of argocd installation. Should be used with argo-username' ,
44
+ describe : 'Password of existing argocd installation. Should be used with argo-username' ,
43
45
} )
44
46
. option ( 'update' , {
45
47
describe : 'Update argocd integration if exists' ,
@@ -70,16 +72,44 @@ const installArgoCmd = new Command({
70
72
} )
71
73
. option ( 'https-proxy' , {
72
74
describe : 'https proxy to be used in the runner' ,
75
+ } )
76
+ // argocd options
77
+ . option ( 'install-manifest' , {
78
+ describe : 'url of argocd install manifest' ,
79
+ default : 'https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml' ,
80
+ } )
81
+ . option ( 'set-argo-password' , {
82
+ required : true ,
83
+ describe : 'set password for admin user of new argocd installation' ,
73
84
} ) ,
74
85
handler : async ( argv ) => {
75
86
let {
76
- // eslint-disable-next-line prefer-const
77
- 'kube-config-path' : kubeConfigPath ,
78
- // eslint-disable-next-line prefer-const
79
87
provider,
80
88
'http-proxy' : httpProxy ,
81
89
'https-proxy' : httpsProxy ,
90
+ 'argo-host' : argoHost ,
91
+ 'argo-username' : argoUsername ,
92
+ 'argo-password' : argoPassword ,
82
93
} = argv ;
94
+ const {
95
+ 'kube-config-path' : kubeConfigPath ,
96
+ 'install-manifest' : installManifest ,
97
+ 'kube-namespace' : kubeNamespace ,
98
+ 'set-argo-password' : setArgoPassword ,
99
+ } = argv ;
100
+
101
+ if ( provider === 'argocd' ) {
102
+ const result = await installArgocd ( {
103
+ installManifest,
104
+ kubeNamespace,
105
+ setArgoPassword,
106
+ } ) ;
107
+
108
+ provider = 'argocd-agent' ;
109
+ argoHost = result . host ;
110
+ argoUsername = 'admin' ;
111
+ argoPassword = setArgoPassword ;
112
+ }
83
113
84
114
const binLocation = await downloadProvider ( { provider } ) ;
85
115
const componentRunner = new Runner ( binLocation ) ;
@@ -93,8 +123,11 @@ const installArgoCmd = new Command({
93
123
commands . push ( kubeConfigPath ) ;
94
124
}
95
125
96
- const installOptions = _ . pick ( argv , [ 'git-integration' , 'codefresh-integration' , 'argo-host' , 'argo-token' , 'output' ,
97
- 'argo-username' , 'argo-password' , 'update' , 'kube-context-name' , 'kube-namespace' , 'sync-mode' , 'sync-apps' ] ) ;
126
+ const installOptions = _ . pick ( argv , [ 'git-integration' , 'codefresh-integration' , 'argo-token' , 'output' ,
127
+ 'update' , 'kube-context-name' , 'kube-namespace' , 'sync-mode' , 'sync-apps' ] ) ;
128
+ installOptions [ 'argo-host' ] = argoHost ;
129
+ installOptions [ 'argo-username' ] = argoUsername ;
130
+ installOptions [ 'argo-password' ] = argoPassword ;
98
131
99
132
_ . forEach ( installOptions , ( value , key ) => {
100
133
if ( _ . isArray ( value ) ) {
0 commit comments