From c6dcc27f6c2d6cdd7c401328ad960c75c7a15ad4 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Mon, 25 Jul 2022 14:25:16 +0100 Subject: [PATCH] schemas: Improve logging & ignoring when generating schemas (#1013) * schemas: Improve logging when generating schemas * schemas: add ignorelist for darwin/arm64 * schemas: ignore casing of source address in ignorelist --- internal/schemas/gen/gen.go | 71 +++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/internal/schemas/gen/gen.go b/internal/schemas/gen/gen.go index 07fc02761..da7a8a31f 100644 --- a/internal/schemas/gen/gen.go +++ b/internal/schemas/gen/gen.go @@ -13,6 +13,8 @@ import ( "net/http" "os" "path/filepath" + "runtime" + "strings" "github.com/hashicorp/go-version" hcinstall "github.com/hashicorp/hc-install" @@ -108,8 +110,6 @@ func gen() error { defer i.Remove(ctx) - log.Println("running terraform init") - cwd, err := os.Getwd() if err != nil { return err @@ -120,6 +120,14 @@ func gen() error { return err } + coreVersion, _, err := tf.Version(ctx, false) + if err != nil { + return err + } + log.Printf("using Terraform %s", coreVersion) + + log.Println("running terraform init") + err = tf.Init(ctx, tfexec.Upgrade(true)) if err != nil { return err @@ -249,23 +257,74 @@ var ignore = map[string]bool{ "delphix-integrations/delphix": true, "harness-io/harness": true, "harness/harness-platform": true, - "HewlettPackard/oneview": true, - "HewlettPackard/hpegl": true, + "hewlettpackard/oneview": true, + "hewlettpackard/hpegl": true, "jradtilbrook/buildkite": true, "kvrhdn/honeycombio": true, "logicmonitor/logicmonitor": true, - "ThalesGroup/ciphertrust": true, + "thalesgroup/ciphertrust": true, "nullstone-io/ns": true, "zededa/zedcloud": true, "lightstep/lightstep": true, "thousandeyes/thousandeyes": true, } +var darwinArm64Ignore = map[string]bool{ + "a10networks/thunder": true, + "alertmixer/amixr": true, + "aristanetworks/cloudvision": true, + "bluecatlabs/bluecat": true, + "ciscodevnet/ciscoasa": true, + "ciscodevnet/mso": true, + "ciscodevnet/sdwan": true, + "cloudtamer-io/cloudtamerio": true, + "cohesity/cohesity": true, + "commvault/commvault": true, + "consensys/quorum": true, + "f5networks/bigip": true, + "gocachebr/gocache": true, + "hashicorp/opc": true, + "hashicorp/oraclepaas": true, + "hashicorp/template": true, + "icinga/icinga2": true, + "infobloxopen/infoblox": true, + "infracost/infracost": true, + "instaclustr/instaclustr": true, + "ionos-cloud/profitbricks": true, + "juniper/junos-vsrx": true, + "llnw/limelight": true, + "netapp/netapp-elementsw": true, + "nirmata/nirmata": true, + "nttcom/ecl": true, + "nutanix/nutanixkps": true, + "oktadeveloper/oktaasa": true, + "phoenixnap/pnap": true, + "purestorage-openconnect/cbs": true, + "rafaysystems/rafay": true, + "rundeck/rundeck": true, + "sematext/sematext": true, + "skytap/skytap": true, + "splunk/synthetics": true, + "splunk/victorops": true, + "statuscakedev/statuscake": true, + "transloadit/transloadit": true, + "valtix-security/valtix": true, + "vmware-tanzu/carvel": true, + "wallix/waapm": true, + "william20111/thousandeyes": true, +} + func filter(providers []provider) (filtered []provider) { for _, provider := range providers { - if ok := ignore[provider.Source()]; ok { + src := strings.ToLower(provider.Source()) + if ok := ignore[src]; ok { continue } + if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + if ok := darwinArm64Ignore[src]; ok { + continue + } + } filtered = append(filtered, provider) } return filtered