Skip to content

[installer-tests] Add annotations to Cron job files #12380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion .werft/aks-installer-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/aks-installer-tests.yaml -a debug=true`
args:
- name: subdomain
desc: "Subdomain to use. A terraform workspace of same name will be used"
required: false
default: ""
- name: channel
desc: "Replicated channel to use"
required: false
default: ""
- name: replicatedApp
desc: "Replicated App to use"
required: false
default: ""
- name: version
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"
required: false
default: ""
- name: skipTests
desc: "Set this to true to skip integration tests"
required: false
default: false
- name: upgrade
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
required: false
default: false
- name: preview
desc: "Setting preview to true creates a self-hosted preview for you to consume"
required: false
default: true
- name: deps
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
required: false
pod:
serviceAccount: werft
affinity:
Expand Down Expand Up @@ -73,6 +105,16 @@ pod:
secretKeyRef:
name: slack-webhook-urls
key: self_hosted_jobs
- name: REPLICATED_API_TOKEN
valueFrom:
secretKeyRef:
name: replicated
key: token
- name: REPLICATED_APP
valueFrom:
secretKeyRef:
name: replicated
key: app
command:
- bash
- -c
Expand All @@ -85,7 +127,12 @@ pod:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-azure
export domain="{{ .Annotations.subdomain }}"
if [[ "$domain" == "<no value>" ]]; then
export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-azure
else
export TF_VAR_TEST_ID="$domain"
fi

(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
printf '{{ toJson . }}' > context.json
Expand Down
12 changes: 11 additions & 1 deletion .werft/cleanup-installer-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ pod:
secretKeyRef:
name: slack-webhook-urls
key: self_hosted_jobs
- name: REPLICATED_API_TOKEN
valueFrom:
secretKeyRef:
name: replicated
key: token
- name: REPLICATED_APP
valueFrom:
secretKeyRef:
name: replicated
key: app
command:
- bash
- -c
Expand All @@ -121,4 +131,4 @@ pod:

npx ts-node .werft/installer-tests.ts ${TESTCONFIG}
plugins:
cron: "15 3 * * *"
cron: "0 */12 * * *"
51 changes: 50 additions & 1 deletion .werft/eks-installer-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/eks-installer-tests.yaml -a debug=true`
args:
- name: subdomain
desc: "Subdomain to use. A terraform workspace of same name will be used"
required: false
default: ""
- name: channel
desc: "Replicated channel to use"
required: false
default: ""
- name: replicatedApp
desc: "Replicated App to use"
required: false
default: ""
- name: version
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"
required: false
default: ""
- name: skipTests
desc: "Set this to true to skip integration tests"
required: false
default: false
- name: upgrade
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
required: false
default: false
- name: preview
desc: "Setting preview to true creates a self-hosted preview for you to consume"
required: false
default: true
- name: deps
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
required: false
pod:
serviceAccount: werft
affinity:
Expand Down Expand Up @@ -68,6 +100,16 @@ pod:
secretKeyRef:
name: slack-webhook-urls
key: self_hosted_jobs
- name: REPLICATED_API_TOKEN
valueFrom:
secretKeyRef:
name: replicated
key: token
- name: REPLICATED_APP
valueFrom:
secretKeyRef:
name: replicated
key: app
command:
- bash
- -c
Expand All @@ -78,7 +120,14 @@ pod:
sudo chown -R gitpod:gitpod /workspace
sudo apt update && apt install gettext-base

export TF_VAR_TEST_ID="$(echo $RANDOM | md5sum | head -c 5; echo)-aws"

export domain="{{ .Annotations.subdomain }}"

if [[ "$domain" == "<no value>" ]]; then
export TF_VAR_TEST_ID="$(echo $RANDOM | md5sum | head -c 5; echo)-aws"
else
export TF_VAR_TEST_ID="$domain"
fi

(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
printf '{{ toJson . }}' > context.json
Expand Down
49 changes: 48 additions & 1 deletion .werft/gke-installer-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/gke-installer-tests.yaml -a debug=true`
args:
- name: subdomain
desc: "Subdomain to use. A terraform workspace of same name will be used"
required: false
default: ""
- name: channel
desc: "Replicated channel to use"
required: false
default: ""
- name: replicatedApp
desc: "Replicated App to use"
required: false
default: ""
- name: version
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"
required: false
default: ""
- name: skipTests
desc: "Set this to true to skip integration tests"
required: false
default: false
- name: upgrade
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
required: false
default: false
- name: preview
desc: "Setting preview to true creates a self-hosted preview for you to consume"
required: false
default: true
- name: deps
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
required: false
pod:
serviceAccount: werft
affinity:
Expand Down Expand Up @@ -55,6 +87,16 @@ pod:
secretKeyRef:
name: slack-webhook-urls
key: self_hosted_jobs
- name: REPLICATED_API_TOKEN
valueFrom:
secretKeyRef:
name: replicated
key: token
- name: REPLICATED_APP
valueFrom:
secretKeyRef:
name: replicated
key: app
command:
- bash
- -c
Expand All @@ -65,7 +107,12 @@ pod:
sudo chown -R gitpod:gitpod /workspace
sudo apt update && apt install gettext-base

export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-gcp
export domain="{{ .Annotations.subdomain }}"
if [[ "$domain" == "<no value>" ]]; then
export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-gcp
else
export TF_VAR_TEST_ID="$domain"
fi

(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
printf '{{ toJson . }}' > context.json
Expand Down
17 changes: 11 additions & 6 deletions .werft/installer-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ const annotations: any = context.Annotations || {};
const testConfig: string = process.argv.length > 2 ? process.argv[2] : "STANDARD_K3S_TEST";

const channel: string = annotations.channel || "unstable";
const kotsApp: string = annotations.replicatedApp || "gitpod";

const version: string = annotations.version || "-";
const preview: string = annotations.preview || "false"; // setting to true will not destroy the setup
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.
const skipTests: string = annotations.skipTests || "false"; // setting to true skips the integration tests
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

const baseDomain: string = "tests.gitpod-self-hosted.com"

const slackHook = new Map<string, string>([
["self-hosted-jobs", process.env.SH_SLACK_NOTIFICATION_PATH.trim()],
["workspace-jobs", process.env.WS_SLACK_NOTIFICATION_PATH.trim()],
Expand Down Expand Up @@ -165,16 +169,16 @@ const INFRA_PHASES: { [name: string]: InfraConfig } = {
ADD_NS_RECORD: {
phase: "add-ns-record",
makeTarget: "add-ns-record",
description: "Adds NS record for subdomain under tests.gitpod-self-hosted.com",
description: `Adds NS record for subdomain under ${baseDomain}`,
},
INSTALL_GITPOD_IGNORE_PREFLIGHTS: {
phase: "install-gitpod-without-preflights",
makeTarget: `kots-install channel=${channel} version=${version} preflights=false`, // this is a bit of a hack, for now we pass params like this
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
description: "Install gitpod using kots community edition without preflights",
},
INSTALL_GITPOD: {
phase: "install-gitpod",
makeTarget: `kots-install channel=${channel} version=${version} preflights=true`,
makeTarget: `kots-install app=${kotsApp} channel=${channel} version=${version} preflights=true`,
description: "Install gitpod using kots community edition",
},
CHECK_INSTALLATION: {
Expand Down Expand Up @@ -320,7 +324,7 @@ export async function installerTests(config: TestConfig) {
werft.phase("print-output", "Get connection details to self-hosted setup");

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

if (testConfig == "STANDARD_K3S_TEST") {
Expand All @@ -341,6 +345,7 @@ export async function installerTests(config: TestConfig) {
// if we are not doing preview, we delete the infrastructure
cleanup();
}

}

function runIntegrationTests() {
Expand Down Expand Up @@ -414,7 +419,7 @@ function randK8sVersion(config: string): string {
break;
}
case "STANDARD_AKS_TEST": {
options = ["1.21", "1.22", "1.23"]
options = ["1.22", "1.23", "1.24"]
break;
}
case "STANDARD_EKS_TEST": {
Expand Down Expand Up @@ -560,7 +565,7 @@ export async function sendPreviewSlackAlert(): Promise<void> {
fields: [
{
type: "mrkdwn",
text: "*URL:*\n<https://" + process.env["TF_VAR_TEST_ID"] + ".tests.gitpod-self-hosted.com|Access preview setup>",
text: "*URL:*\n<https://" + process.env["TF_VAR_TEST_ID"] + `.${baseDomain}|Access preview setup>`,
},
{
type: "mrkdwn",
Expand Down
2 changes: 1 addition & 1 deletion .werft/jobs/build/self-hosted-upgrade-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function triggerUpgradeTests(werft: Werft, config: JobConfig, usern

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

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

try {
exec(
Expand Down
50 changes: 49 additions & 1 deletion .werft/k3s-installer-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
# debug using `werft run github -f -s .werft/installer-tests.ts -j .werft/k3s-installer-tests.yaml -a debug=true`
args:
- name: subdomain
desc: "Subdomain to use. A terraform workspace of same name will be used"
required: false
default: ""
- name: channel
desc: "Replicated channel to use"
required: false
default: ""
- name: replicatedApp
desc: "Replicated App to use"
required: false
default: ""
- name: version
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"
required: false
default: ""
- name: skipTests
desc: "Set this to true to skip integration tests"
required: false
default: false
- name: upgrade
desc: "Set this to true to run KOTS upgrade from the specified version to the latest version"
required: false
default: false
- name: preview
desc: "Setting preview to true creates a self-hosted preview for you to consume"
required: false
default: true
- name: deps
desc: "Specify if the dependencies(storage, db, registry) should be external or incluster. If unset, a random combination will be chosen. options:[external, incluster]"
required: false
pod:
serviceAccount: werft
affinity:
Expand Down Expand Up @@ -60,6 +92,16 @@ pod:
secretKeyRef:
name: slack-webhook-urls
key: self_hosted_jobs
- name: REPLICATED_API_TOKEN
valueFrom:
secretKeyRef:
name: replicated
key: token
- name: REPLICATED_APP
valueFrom:
secretKeyRef:
name: replicated
key: app
command:
- bash
- -c
Expand All @@ -72,7 +114,13 @@ pod:

curl -sLS https://get.k3sup.dev | sh

export TF_VAR_TEST_ID=$(echo $RANDOM | md5sum | head -c 5; echo)-k3s
export domain="{{ .Annotations.subdomain }}"

if [[ "$domain" == "<no value>" ]]; then
export TF_VAR_TEST_ID="$(echo $RANDOM | md5sum | head -c 5; echo)-k3s"
else
export TF_VAR_TEST_ID="$domain"
fi

(cd .werft && yarn install && mv node_modules ..) | werft log slice prep
printf '{{ toJson . }}' > context.json
Expand Down
Loading