Skip to content

Commit 61a7be3

Browse files
committed
[installer-tests] Add annotations to Cron job files
1 parent 9cd8ba4 commit 61a7be3

11 files changed

+240
-206
lines changed

.werft/aks-installer-tests.yaml

+48-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/aks-installer-tests.yaml -a debug=true`
2+
args:
3+
- name: subdomain
4+
desc: "Subdomain to use. A terraform workspace of same name will be used"
5+
required: false
6+
default: ""
7+
- name: channel
8+
desc: "Replicated channel to use"
9+
required: false
10+
default: ""
11+
- name: replicatedApp
12+
desc: "Replicated App to use"
13+
required: false
14+
default: ""
15+
- name: version
16+
desc: "Version of gitpod to install(in the case of upgrade tests, this is the initial install version and will later get upgraded to latest"
17+
required: false
18+
default: ""
19+
- name: skipTests
20+
desc: "Set this to true to skip integration tests"
21+
required: false
22+
default: false
23+
- name: upgrade
24+
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
25+
required: false
26+
default: false
27+
- name: preview
28+
desc: "Setting preview to true creates a self-hosted preview for you to consume"
29+
required: false
30+
default: true
31+
- name: deps
32+
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
33+
required: false
234
pod:
335
serviceAccount: werft
436
affinity:
@@ -73,6 +105,16 @@ pod:
73105
secretKeyRef:
74106
name: slack-webhook-urls
75107
key: self_hosted_jobs
108+
- name: REPLICATED_API_TOKEN
109+
valueFrom:
110+
secretKeyRef:
111+
name: replicated
112+
key: token
113+
- name: REPLICATED_APP
114+
valueFrom:
115+
secretKeyRef:
116+
name: replicated
117+
key: app
76118
command:
77119
- bash
78120
- -c
@@ -85,7 +127,12 @@ pod:
85127
86128
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
87129
88-
export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-azure
130+
export domain="{{ .Annotations.subdomain }}"
131+
if [[ "$domain" == "<no value>" ]]; then
132+
export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-azure
133+
else
134+
export TF_VAR_TEST_ID="$domain"
135+
fi
89136
90137
(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
91138
printf '{{ toJson . }}' > context.json

.werft/cleanup-installer-tests.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ pod:
9898
secretKeyRef:
9999
name: slack-webhook-urls
100100
key: self_hosted_jobs
101+
- name: REPLICATED_API_TOKEN
102+
valueFrom:
103+
secretKeyRef:
104+
name: replicated
105+
key: token
106+
- name: REPLICATED_APP
107+
valueFrom:
108+
secretKeyRef:
109+
name: replicated
110+
key: app
101111
command:
102112
- bash
103113
- -c
@@ -121,4 +131,4 @@ pod:
121131
122132
npx ts-node .werft/installer-tests.ts ${TESTCONFIG}
123133
plugins:
124-
cron: "15 3 * * *"
134+
cron: "0 */12 * * *"

.werft/eks-installer-tests.yaml

+50-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/eks-installer-tests.yaml -a debug=true`
2+
args:
3+
- name: subdomain
4+
desc: "Subdomain to use. A terraform workspace of same name will be used"
5+
required: false
6+
default: ""
7+
- name: channel
8+
desc: "Replicated channel to use"
9+
required: false
10+
default: ""
11+
- name: replicatedApp
12+
desc: "Replicated App to use"
13+
required: false
14+
default: ""
15+
- name: version
16+
desc: "Version of gitpod to install(in the case of upgrade tests, this is the initial install version and will later get upgraded to latest"
17+
required: false
18+
default: ""
19+
- name: skipTests
20+
desc: "Set this to true to skip integration tests"
21+
required: false
22+
default: false
23+
- name: upgrade
24+
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
25+
required: false
26+
default: false
27+
- name: preview
28+
desc: "Setting preview to true creates a self-hosted preview for you to consume"
29+
required: false
30+
default: true
31+
- name: deps
32+
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
33+
required: false
234
pod:
335
serviceAccount: werft
436
affinity:
@@ -68,6 +100,16 @@ pod:
68100
secretKeyRef:
69101
name: slack-webhook-urls
70102
key: self_hosted_jobs
103+
- name: REPLICATED_API_TOKEN
104+
valueFrom:
105+
secretKeyRef:
106+
name: replicated
107+
key: token
108+
- name: REPLICATED_APP
109+
valueFrom:
110+
secretKeyRef:
111+
name: replicated
112+
key: app
71113
command:
72114
- bash
73115
- -c
@@ -78,7 +120,14 @@ pod:
78120
sudo chown -R gitpod:gitpod /workspace
79121
sudo apt update && apt install gettext-base
80122
81-
export TF_VAR_TEST_ID="$(echo $RANDOM | md5sum | head -c 5; echo)-aws"
123+
124+
export domain="{{ .Annotations.subdomain }}"
125+
126+
if [[ "$domain" == "<no value>" ]]; then
127+
export TF_VAR_TEST_ID="$(echo $RANDOM | md5sum | head -c 5; echo)-aws"
128+
else
129+
export TF_VAR_TEST_ID="$domain"
130+
fi
82131
83132
(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
84133
printf '{{ toJson . }}' > context.json

.werft/gke-installer-tests.yaml

+48-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/gke-installer-tests.yaml -a debug=true`
2+
args:
3+
- name: subdomain
4+
desc: "Subdomain to use. A terraform workspace of same name will be used"
5+
required: false
6+
default: ""
7+
- name: channel
8+
desc: "Replicated channel to use"
9+
required: false
10+
default: ""
11+
- name: replicatedApp
12+
desc: "Replicated App to use"
13+
required: false
14+
default: ""
15+
- name: version
16+
desc: "Version of gitpod to install(in the case of upgrade tests, this is the initial install version and will later get upgraded to latest"
17+
required: false
18+
default: ""
19+
- name: skipTests
20+
desc: "Set this to true to skip integration tests"
21+
required: false
22+
default: false
23+
- name: upgrade
24+
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
25+
required: false
26+
default: false
27+
- name: preview
28+
desc: "Setting preview to true creates a self-hosted preview for you to consume"
29+
required: false
30+
default: true
31+
- name: deps
32+
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
33+
required: false
234
pod:
335
serviceAccount: werft
436
affinity:
@@ -55,6 +87,16 @@ pod:
5587
secretKeyRef:
5688
name: slack-webhook-urls
5789
key: self_hosted_jobs
90+
- name: REPLICATED_API_TOKEN
91+
valueFrom:
92+
secretKeyRef:
93+
name: replicated
94+
key: token
95+
- name: REPLICATED_APP
96+
valueFrom:
97+
secretKeyRef:
98+
name: replicated
99+
key: app
58100
command:
59101
- bash
60102
- -c
@@ -65,7 +107,12 @@ pod:
65107
sudo chown -R gitpod:gitpod /workspace
66108
sudo apt update && apt install gettext-base
67109
68-
export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-gcp
110+
export domain="{{ .Annotations.subdomain }}"
111+
if [[ "$domain" == "<no value>" ]]; then
112+
export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-gcp
113+
else
114+
export TF_VAR_TEST_ID="$domain"
115+
fi
69116
70117
(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
71118
printf '{{ toJson . }}' > context.json

.werft/installer-tests.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ const annotations: any = context.Annotations || {};
1111
const testConfig: string = process.argv.length > 2 ? process.argv[2] : "STANDARD_K3S_TEST";
1212

1313
const channel: string = annotations.channel || "unstable";
14+
const kotsApp: string = annotations.replicatedApp || "gitpod";
15+
1416
const version: string = annotations.version || "-";
1517
const preview: string = annotations.preview || "false"; // setting to true will not destroy the setup
1618
const upgrade: string = annotations.upgrade || "false"; // setting to true will not KOTS upgrade to the latest version. Set the channel to beta or stable in this case.
1719
const skipTests: string = annotations.skipTests || "false"; // setting to true skips the integration tests
1820
const deps: string = annotations.deps || ""; // options: ["external", "internal"] setting to `external` will ensure that all resource dependencies(storage, db, registry) will be external. if unset, a random selection will be used
1921

22+
const baseDomain: string = "tests.gitpod-self-hosted.com"
23+
2024
const slackHook = new Map<string, string>([
2125
["self-hosted-jobs", process.env.SH_SLACK_NOTIFICATION_PATH.trim()],
2226
["workspace-jobs", process.env.WS_SLACK_NOTIFICATION_PATH.trim()],
@@ -165,16 +169,16 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
165169
ADD_NS_RECORD: {
166170
phase: "add-ns-record",
167171
makeTarget: "add-ns-record",
168-
description: "Adds NS record for subdomain under tests.gitpod-self-hosted.com",
172+
description: `Adds NS record for subdomain under ${baseDomain}`,
169173
},
170174
INSTALL_GITPOD_IGNORE_PREFLIGHTS: {
171175
phase: "install-gitpod-without-preflights",
172-
makeTarget: `kots-install channel=${channel} version=${version} preflights=false`, // this is a bit of a hack, for now we pass params like this
176+
makeTarget: `kots-install app=${kotsApp} channel=${channel} version=${version} preflights=false`, // this is a bit of a hack, for now we pass params like this
173177
description: "Install gitpod using kots community edition without preflights",
174178
},
175179
INSTALL_GITPOD: {
176180
phase: "install-gitpod",
177-
makeTarget: `kots-install channel=${channel} version=${version} preflights=true`,
181+
makeTarget: `kots-install app=${kotsApp} channel=${channel} version=${version} preflights=true`,
178182
description: "Install gitpod using kots community edition",
179183
},
180184
CHECK_INSTALLATION: {
@@ -320,7 +324,7 @@ export async function installerTests(config: TestConfig) {
320324
werft.phase("print-output", "Get connection details to self-hosted setup");
321325

322326
exec(
323-
`werft log result -d "self-hosted preview url" url "https://${process.env["TF_VAR_TEST_ID"]}.tests.gitpod-self-hosted.com"`,
327+
`werft log result -d "self-hosted preview url" url "https://${process.env["TF_VAR_TEST_ID"]}.${baseDomain}"`,
324328
);
325329

326330
if (testConfig == "STANDARD_K3S_TEST") {
@@ -341,6 +345,7 @@ export async function installerTests(config: TestConfig) {
341345
// if we are not doing preview, we delete the infrastructure
342346
cleanup();
343347
}
348+
344349
}
345350

346351
function runIntegrationTests() {
@@ -560,7 +565,7 @@ export async function sendPreviewSlackAlert(): Promise<void> {
560565
fields: [
561566
{
562567
type: "mrkdwn",
563-
text: "*URL:*\n<https://" + process.env["TF_VAR_TEST_ID"] + ".tests.gitpod-self-hosted.com|Access preview setup>",
568+
text: "*URL:*\n<https://" + process.env["TF_VAR_TEST_ID"] + `.${baseDomain}|Access preview setup>`,
564569
},
565570
{
566571
type: "mrkdwn",

.werft/jobs/build/self-hosted-upgrade-tests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function triggerUpgradeTests(werft: Werft, config: JobConfig, usern
4848

4949
annotation = `${annotation} -a cluster=${phase} -a updateGitHubStatus=gitpod-io/gitpod`
5050

51-
const testFile: string = ".werft/self-hosted-installer-tests.yaml";
51+
const testFile: string = `.werft/${phase}-installer-tests.yaml`;
5252

5353
try {
5454
exec(

.werft/k3s-installer-tests.yaml

+49-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/k3s-installer-tests.yaml -a debug=true`
2+
args:
3+
- name: subdomain
4+
desc: "Subdomain to use. A terraform workspace of same name will be used"
5+
required: false
6+
default: ""
7+
- name: channel
8+
desc: "Replicated channel to use"
9+
required: false
10+
default: ""
11+
- name: replicatedApp
12+
desc: "Replicated App to use"
13+
required: false
14+
default: ""
15+
- name: version
16+
desc: "Version of gitpod to install(in the case of upgrade tests, this is the initial install version and will later get upgraded to latest"
17+
required: false
18+
default: ""
19+
- name: skipTests
20+
desc: "Set this to true to skip integration tests"
21+
required: false
22+
default: false
23+
- name: upgrade
24+
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
25+
required: false
26+
default: false
27+
- name: preview
28+
desc: "Setting preview to true creates a self-hosted preview for you to consume"
29+
required: false
30+
default: true
31+
- name: deps
32+
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
33+
required: false
234
pod:
335
serviceAccount: werft
436
affinity:
@@ -60,6 +92,16 @@ pod:
6092
secretKeyRef:
6193
name: slack-webhook-urls
6294
key: self_hosted_jobs
95+
- name: REPLICATED_API_TOKEN
96+
valueFrom:
97+
secretKeyRef:
98+
name: replicated
99+
key: token
100+
- name: REPLICATED_APP
101+
valueFrom:
102+
secretKeyRef:
103+
name: replicated
104+
key: app
63105
command:
64106
- bash
65107
- -c
@@ -72,7 +114,13 @@ pod:
72114
73115
curl -sLS https://get.k3sup.dev | sh
74116
75-
export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-k3s
117+
export domain="{{ .Annotations.subdomain }}"
118+
119+
if [[ "$domain" == "<no value>" ]]; then
120+
export TF_VAR_TEST_ID="$(echo $RANDOM | md5sum | head -c 5; echo)-k3s"
121+
else
122+
export TF_VAR_TEST_ID="$domain"
123+
fi
76124
77125
(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
78126
printf '{{ toJson . }}' > context.json

0 commit comments

Comments
 (0)