File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ let werft: Werft;
20
20
21
21
const context : any = JSON . parse ( fs . readFileSync ( "context.json" ) . toString ( ) ) ;
22
22
const annotations = context . Annotations || { } ;
23
+ const previewName = annotations [ "preview" ] || "" ;
23
24
24
25
Tracing . initialize ( )
25
26
. then ( ( ) => {
@@ -42,6 +43,11 @@ Tracing.initialize()
42
43
} ) ;
43
44
44
45
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
+
45
51
werft . phase ( "Configure access" ) ;
46
52
try {
47
53
const GCLOUD_SERVICE_ACCOUNT_PATH = "/mnt/secrets/gcp-sa/service-account.json" ;
@@ -67,7 +73,7 @@ async function deletePreviewEnvironment() {
67
73
werft . fail ( SLICES . INSTALL_HARVESTER_KUBECONFIG , err ) ;
68
74
}
69
75
70
- const preview = new HarvesterPreviewEnvironment ( annotations [ "previewNamespace" ] )
76
+ const preview = new HarvesterPreviewEnvironment ( previewName )
71
77
if ( DRY_RUN ) {
72
78
werft . log ( "DRY RUN" , `Would have deleted preview ${ preview . name } ` )
73
79
} else {
You can’t perform that action at this time.
0 commit comments