@@ -4,7 +4,10 @@ import { Werft } from "./util/werft";
4
4
5
5
const testConfig : string = process . argv . length > 2 ? process . argv [ 2 ] : "STANDARD_K3S_TEST" ;
6
6
// we can provide the version of the gitpod to install (eg: 2022.4.2)
7
- const version : string = process . argv . length > 3 ? process . argv [ 3 ] : "" ;
7
+ // "-" is the default value which will install the latest version
8
+ const version : string = process . argv . length > 3 ? process . argv [ 3 ] : "-" ;
9
+
10
+ const channel : string = process . argv . length > 4 ? process . argv [ 4 ] : "unstable" ;
8
11
9
12
const makefilePath : string = join ( "install/tests" ) ;
10
13
@@ -41,14 +44,19 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
41
44
makeTarget : "managed-dns" ,
42
45
description : "Sets up external-dns & cloudDNS config" ,
43
46
} ,
47
+ GENERATE_KOTS_CONFIG : {
48
+ phase : "generate-kots-config" ,
49
+ makeTarget : "generate-kots-config" ,
50
+ description : `Generate KOTS Config file` ,
51
+ } ,
44
52
INSTALL_GITPOD_IGNORE_PREFLIGHTS : {
45
53
phase : "install-gitpod-without-preflights" ,
46
- makeTarget : `kots-install channel=unstable version=${ version } preflights=false` , // this is a bit of a hack, for now we pass params like this
54
+ makeTarget : `kots-install channel=${ channel } version=${ version } preflights=false` , // this is a bit of a hack, for now we pass params like this
47
55
description : "Install gitpod using kots community edition without preflights" ,
48
56
} ,
49
57
INSTALL_GITPOD : {
50
58
phase : "install-gitpod" ,
51
- makeTarget : `kots-install channel=unstable version=${ version } preflights=true` ,
59
+ makeTarget : `kots-install channel=${ channel } version=${ version } preflights=true` ,
52
60
description : "Install gitpod using kots community edition" ,
53
61
} ,
54
62
CHECK_INSTALLATION : {
@@ -57,6 +65,11 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
57
65
makeTarget : "check-gitpod-installation" ,
58
66
description : "Check gitpod installation" ,
59
67
} ,
68
+ KOTS_UPGRADE : {
69
+ phase : "kots-upgrade" ,
70
+ makeTarget : "kots-uprgade" ,
71
+ description : "Upgrade Gitpod installation to latest version using KOTS CLI" ,
72
+ } ,
60
73
RUN_INTEGRATION_TESTS : {
61
74
phase : "run-integration-tests" ,
62
75
makeTarget : "run-tests" ,
@@ -88,21 +101,37 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
88
101
"STANDARD_GKE_CLUSTER" ,
89
102
"CERT_MANAGER" ,
90
103
"GCP_MANAGED_DNS" ,
104
+ "GENERATE_KOTS_CONFIG" ,
91
105
"INSTALL_GITPOD" ,
92
106
"CHECK_INSTALLATION" ,
93
107
"RUN_INTEGRATION_TESTS" ,
94
108
"RESULTS" ,
95
109
"DESTROY" ,
96
110
] ,
97
111
} ,
112
+ STANDARD_GKE_UPGRADE_TEST : {
113
+ DESCRIPTION : `Deploy Gitpod on GKE, and test upgrade from ${ version } to latest version` ,
114
+ PHASES : [
115
+ "STANDARD_GKE_CLUSTER" ,
116
+ "CERT_MANAGER" ,
117
+ "GCP_MANAGED_DNS" ,
118
+ "GENERATE_KOTS_CONFIG" ,
119
+ "INSTALL_GITPOD" ,
120
+ "CHECK_INSTALLATION" ,
121
+ "KOTS_UPGRADE" ,
122
+ "CHECK_INSTALLATION" ,
123
+ "DESTROY" ,
124
+ ] ,
125
+ } ,
98
126
STANDARD_K3S_TEST : {
99
127
DESCRIPTION :
100
128
"Deploy Gitpod on a K3s cluster, created on a GCP instance," +
101
129
" with managed DNS and run integrations tests" ,
102
130
PHASES : [
103
131
"STANDARD_K3S_CLUSTER_ON_GCP" ,
104
132
"CERT_MANAGER" ,
105
- "INSTALL_GITPOD_IGNORE_PREFLIGHTS" ,
133
+ "GENERATE_KOTS_CONFIG" ,
134
+ "INSTALL_GITPOD" ,
106
135
"CHECK_INSTALLATION" ,
107
136
"RUN_INTEGRATION_TESTS" ,
108
137
"RESULTS" ,
@@ -113,8 +142,9 @@ const TEST_CONFIGURATIONS: { [name: string]: TestConfig } = {
113
142
DESCRIPTION : "Create a SH Gitpod preview environment on a K3s cluster, created on a GCP instance" ,
114
143
PHASES : [
115
144
"STANDARD_K3S_CLUSTER_ON_GCP" ,
116
- "GCP_MANAGED_DNS" ,
117
- "INSTALL_GITPOD_IGNORE_PREFLIGHTS" ,
145
+ "CERT_MANAGER" ,
146
+ "GENERATE_KOTS_CONFIG" ,
147
+ "INSTALL_GITPOD" ,
118
148
"CHECK_INSTALLATION" ,
119
149
"RESULTS" ,
120
150
] ,
@@ -144,8 +174,9 @@ function getKubeconfig() {
144
174
export async function installerTests ( config : TestConfig ) {
145
175
console . log ( config . DESCRIPTION ) ;
146
176
for ( let phase of config . PHASES ) {
147
- const phaseSteps = INFRA_PHASES [ phase ] ;
148
- const ret = callMakeTargets ( phaseSteps . phase , phaseSteps . description , phaseSteps . makeTarget ) ;
177
+ const args = phase . split ( " " ) ;
178
+ const phaseSteps = INFRA_PHASES [ args [ 0 ] ] ;
179
+ const ret = callMakeTargets ( phaseSteps . phase , phaseSteps . description , phaseSteps . makeTarget , args . slice ( 1 ) ) ;
149
180
if ( ret ) {
150
181
// there is not point in continuing if one stage fails
151
182
// TODO: maybe add failable, phases
@@ -154,8 +185,8 @@ export async function installerTests(config: TestConfig) {
154
185
}
155
186
}
156
187
157
- function callMakeTargets ( phase : string , description : string , makeTarget : string ) {
158
- werft . phase ( phase , description ) ;
188
+ function callMakeTargets ( phase : string , description : string , makeTarget : string , args : string [ ] ) {
189
+ werft . phase ( phase , ` ${ description } ${ args } ` ) ;
159
190
160
191
const response = exec ( `make -C ${ makefilePath } ${ makeTarget } ` , { slice : "call-make-target" , dontCheckRc : true } ) ;
161
192
@@ -170,6 +201,10 @@ function callMakeTargets(phase: string, description: string, makeTarget: string)
170
201
return response . code ;
171
202
}
172
203
204
+ function sample ( stages : string [ ] ) : string {
205
+ return stages [ Math . floor ( Math . random ( ) * stages . length ) ] ;
206
+ }
207
+
173
208
function cleanup ( ) {
174
209
const phase = "destroy-infrastructure" ;
175
210
werft . phase ( phase , "Destroying all the created resources" ) ;
0 commit comments