Skip to content

Commit cb80f63

Browse files
committed
wip
Signed-off-by: ArthurSens <[email protected]>
1 parent 7346407 commit cb80f63

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.werft/platform-delete-preview-environment.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let werft: Werft;
2020

2121
const context: any = JSON.parse(fs.readFileSync("context.json").toString());
2222
const annotations = context.Annotations || {};
23+
const previewName = annotations["preview"] || "";
2324

2425
Tracing.initialize()
2526
.then(() => {
@@ -42,6 +43,11 @@ Tracing.initialize()
4243
});
4344

4445
async function deletePreviewEnvironment() {
46+
// Fail early if no preview was passed through annotations.
47+
if (previewName == "") {
48+
werft.fail("Preparation", "A preview name is required. Please inform the preview name with '-a preview=<name of the preview>'.")
49+
}
50+
4551
werft.phase("Configure access");
4652
try {
4753
const GCLOUD_SERVICE_ACCOUNT_PATH = "/mnt/secrets/gcp-sa/service-account.json";
@@ -67,7 +73,7 @@ async function deletePreviewEnvironment() {
6773
werft.fail(SLICES.INSTALL_HARVESTER_KUBECONFIG, err);
6874
}
6975

70-
const preview = new HarvesterPreviewEnvironment(annotations["previewNamespace"])
76+
const preview = new HarvesterPreviewEnvironment(previewName)
7177
if (DRY_RUN) {
7278
werft.log("DRY RUN", `Would have deleted preview ${preview.name}`)
7379
} else {

0 commit comments

Comments
 (0)