...
1
2
3 package gcp
4
5 import (
6 gcpinfra "edge-infra.dev/pkg/edge/gcpinfra/constants"
7 "edge-infra.dev/test/framework"
8 "edge-infra.dev/test/framework/config"
9 )
10
11
12
13
14
15
16 var GCloud struct {
17 ProjectID string `name:"project-id" description:"gcp project to use for tests"`
18 StorageBucket string `name:"storage-bucket" description:"google cloud storage bucket name"`
19 FolderID string `name:"folder-id" description:"gcp folder id to use for tests"`
20 BillingAccount string `name:"billing-account" description:"gcp billing account"`
21 ArtifactRegistry struct {
22 ProjectID string `name:"registry-project-id" description:"gcp project hosting the artifact registry" default:"ret-edge-pltf-preprod-infra"`
23 Location string `name:"registry-location" description:"location where artifact registry lives" default:"us-east1"`
24 ResourceID string `name:"registry-resource-id" description:"the gcp resource id" default:"preprod"`
25 }
26 }
27
28 func init() {
29 _ = config.AddOptions(&GCloud, "gcp")
30 }
31
32
33
34
35
36 func Defaults() {
37 if GCloud.BillingAccount == "" {
38 GCloud.BillingAccount = gcpinfra.DefaultBillingAccountID
39 }
40 }
41
42
43 func NeedsProjectID(f *framework.Framework) {
44 if GCloud.ProjectID == "" {
45 f.Skip("GCloud", "no gcloud project ID was provided via -gcp.project-id")
46 }
47 }
48
49
50 func NeedsStorageBucket(f *framework.Framework) {
51 if GCloud.StorageBucket == "" {
52 f.Skip("GCloud", "no GCS bucket name was provided via -gcp.storage-bucket")
53 }
54 }
55
56
57 func NeedsFolderID(f *framework.Framework) {
58 if GCloud.FolderID == "" {
59 f.Skip("GCloud", "no folder ID was provided via -gcp.folder-id")
60 }
61 }
62
63
64 func NeedsBillingAccount(f *framework.Framework) {
65 if GCloud.BillingAccount == "" {
66 f.Skip("GCloud", "no billing account ID was provided via -gcp.billing-account")
67 }
68 }
69
View as plain text