From 1564668ee894fdd575e9ddca29ab3075dc80918f Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Thu, 22 Aug 2024 10:58:40 -0500 Subject: [PATCH 01/27] feat: added print messages for debugging for data_source_schema.go --- schemaregistry/data_source_schema.go | 18 ++++++++++++++++++ test-new-build.sh | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/schemaregistry/data_source_schema.go b/schemaregistry/data_source_schema.go index 8fe8b9d..5467322 100644 --- a/schemaregistry/data_source_schema.go +++ b/schemaregistry/data_source_schema.go @@ -6,6 +6,7 @@ import ( "github.com/ashleybill/srclient" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -58,6 +59,23 @@ func dataSourceSchema() *schema.Resource { }, }, }, + CustomizeDiff: customdiff.All( + customdiff.ValidateChange("schema", func(ctx context.Context, old, new, meta any) error { + // If we are increasing "size" then the new value must be + // a multiple of the old value. + + println(old.(string)) + println(new.(string)) + + if new.(int) <= old.(int) { + return nil + } + if (new.(int) % old.(int)) != 0 { + return fmt.Errorf("new size value must be an integer multiple of old value %d", old.(int)) + } + return nil + }), + ), } } diff --git a/test-new-build.sh b/test-new-build.sh index 8cf27f1..bae6c77 100755 --- a/test-new-build.sh +++ b/test-new-build.sh @@ -1,7 +1,6 @@ -cd .. || exit make build cp dist/terraform-provider-schemaregistry ~/.terraform.d/plugins/local/fetch-rewards/confluent-schema-registry/1.1.0/darwin_arm64/terraform-provider-confluent-schema-registry_1.1.0 -cd terraform-files-test || exit +cd terraform-test-files || exit rm -rf .terraform/providers rm .terraform.lock.hcl terraform init \ No newline at end of file From c17de6d7d76b0f7c56c7d71f89c9ba064022413b Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Thu, 22 Aug 2024 12:03:07 -0500 Subject: [PATCH 02/27] modified Makefile and test-new-build.sh to work locally when running the new command `local_install` --- Makefile | 13 +++++++++---- test-new-build.sh | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 54325aa..128b8d6 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ # TEST?=$$(go list ./schemaregistry/... | grep -v 'vendor') TEST?=./schemaregistry/... -HOSTNAME=github.com -NAMESPACE=arkiaconsulting -NAME=schemaregistry +HOSTNAME=local +NAMESPACE=fetch-rewards +NAME=confluent-schema-registry BINARY=terraform-provider-${NAME} -VERSION=0.6 +VERSION=1.1.0 +# change this based on system arch linux_amd64 or darwin_arm64 OS_ARCH=linux_amd64 default: install @@ -30,6 +31,10 @@ install: build mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH} mv ./dist/${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH} +local_install: build + mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH} + cp ./dist/${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}/${BINARY}_${VERSION} + test: go test -i $(TEST) || exit 1 echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4 diff --git a/test-new-build.sh b/test-new-build.sh index bae6c77..417d62f 100755 --- a/test-new-build.sh +++ b/test-new-build.sh @@ -1,5 +1,6 @@ -make build -cp dist/terraform-provider-schemaregistry ~/.terraform.d/plugins/local/fetch-rewards/confluent-schema-registry/1.1.0/darwin_arm64/terraform-provider-confluent-schema-registry_1.1.0 +# make build +# cp dist/terraform-provider-schemaregistry ~/.terraform.d/plugins/local/fetch-rewards/confluent-schema-registry/1.1.0/linux_amd64/terraform-provider-confluent-schema-registry_1.1.0 +make local_install cd terraform-test-files || exit rm -rf .terraform/providers rm .terraform.lock.hcl From 6caa722b1a37c1a8c3513f9e4801ca85f3d4dfd5 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Fri, 23 Aug 2024 11:02:26 -0500 Subject: [PATCH 03/27] reverted changes to data_source_schema --- schemaregistry/data_source_schema.go | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/schemaregistry/data_source_schema.go b/schemaregistry/data_source_schema.go index 5467322..3da0f85 100644 --- a/schemaregistry/data_source_schema.go +++ b/schemaregistry/data_source_schema.go @@ -6,7 +6,8 @@ import ( "github.com/ashleybill/srclient" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" + + // "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -59,23 +60,6 @@ func dataSourceSchema() *schema.Resource { }, }, }, - CustomizeDiff: customdiff.All( - customdiff.ValidateChange("schema", func(ctx context.Context, old, new, meta any) error { - // If we are increasing "size" then the new value must be - // a multiple of the old value. - - println(old.(string)) - println(new.(string)) - - if new.(int) <= old.(int) { - return nil - } - if (new.(int) % old.(int)) != 0 { - return fmt.Errorf("new size value must be an integer multiple of old value %d", old.(int)) - } - return nil - }), - ), } } From 62aef065dc3d610e6e47c86b51fc0ef69d163549 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Fri, 23 Aug 2024 11:03:49 -0500 Subject: [PATCH 04/27] feat: added buf cli formatting to the custom diff checks, formatting botht the FSD given string and SR given string in 2 places --- schemaregistry/resource_schema.go | 127 +++++++++++++++++++++++++----- 1 file changed, 109 insertions(+), 18 deletions(-) diff --git a/schemaregistry/resource_schema.go b/schemaregistry/resource_schema.go index 4c97f9d..d6581c3 100644 --- a/schemaregistry/resource_schema.go +++ b/schemaregistry/resource_schema.go @@ -3,6 +3,10 @@ package schemaregistry import ( "context" "fmt" + "log" + "os" + "os/exec" + "regexp" "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" @@ -22,16 +26,34 @@ func resourceSchema() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - CustomizeDiff: customdiff.ComputedIf("version", func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool { - oldState, newState := d.GetChange("schema") - newJSON, _ := structure.NormalizeJsonString(newState) - oldJSON, _ := structure.NormalizeJsonString(oldState) - schemaHasChange := newJSON != oldJSON - - // explicitly set a version change on schema change and make dependencies aware of a - // version changed at `plan` time (computed field) - return schemaHasChange || d.HasChange("version") - }), + CustomizeDiff: customdiff.All( + customdiff.ComputedIf("version", func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool { + + var schemaHasChange bool + oldState, newState := d.GetChange("schema") + + if schemaTypeStr, ok := d.Get("schema_type").(string); ok { + if strings.ToLower(schemaTypeStr) == "json" { + newJSON, _ := structure.NormalizeJsonString(newState) + oldJSON, _ := structure.NormalizeJsonString(oldState) + schemaHasChange = newJSON != oldJSON + } else if strings.ToLower(schemaTypeStr) == "avro" { + newJSON, _ := structure.NormalizeJsonString(newState) + oldJSON, _ := structure.NormalizeJsonString(oldState) + schemaHasChange = newJSON != oldJSON + } else if strings.ToLower(schemaTypeStr) == "protobuf" { + newProtoString := formatProtoString(newState.(string)) + oldProtoString := formatProtoString(oldState.(string)) + + schemaHasChange = oldProtoString != newProtoString + } + } + log.Printf("[INFO] Schemas Equal %t", schemaHasChange) + log.Printf("[INFO] Version Change %t", d.HasChange("version")) + + return schemaHasChange || d.HasChange("version") + }), + ), Schema: map[string]*schema.Schema{ "subject": { Type: schema.TypeString, @@ -44,9 +66,24 @@ func resourceSchema() *schema.Resource { Required: true, Description: "The schema string", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - newJSON, _ := structure.NormalizeJsonString(new) - oldJSON, _ := structure.NormalizeJsonString(old) - return newJSON == oldJSON + var schemaEquals bool + + if schemaTypeStr, ok := d.Get("schema_type").(string); ok { + if strings.ToLower(schemaTypeStr) == "json" { + newJSON, _ := structure.NormalizeJsonString(new) + oldJSON, _ := structure.NormalizeJsonString(old) + schemaEquals = newJSON == oldJSON + } else if strings.ToLower(schemaTypeStr) == "avro" { + newJSON, _ := structure.NormalizeJsonString(new) + oldJSON, _ := structure.NormalizeJsonString(old) + schemaEquals = newJSON == oldJSON + } else if strings.ToLower(schemaTypeStr) == "protobuf" { + newProtoString := formatProtoString(new) + oldProtoString := formatProtoString(old) + schemaEquals = newProtoString == oldProtoString + } + } + return schemaEquals }, }, "schema_id": { @@ -93,6 +130,59 @@ func resourceSchema() *schema.Resource { } } +func formatProtoString(protoSchemaString string) string { + re := regexp.MustCompile(`\s+`) + protoSchemaString = re.ReplaceAllString(protoSchemaString, " ") + + // Create a custom temporary directory + // Have to create a custom tmp dir because otherwise the original one has incorrect permissions to create a temp file and then read it later + customTempDir := "./custom-temp" + if err := os.MkdirAll(customTempDir, 0755); err != nil { + log.Fatalf("Error creating custom temp directory: %v", err) + } + defer os.RemoveAll(customTempDir) // Clean up the directory afterwards + + // Create a temporary file + tmpFile, err := os.CreateTemp(customTempDir, "*.proto") + if err != nil { + log.Println("[INFO] Error creating temporary file:", err) + // TODO raise error here + } + + defer os.Remove(tmpFile.Name()) // Clean up the file afterwards + + // Write the protobuf string to the file + if _, err := tmpFile.WriteString(protoSchemaString); err != nil { + log.Println("[INFO] Error writing to temporary file:", err) + // TODO raise error here + } + + // Close the file to ensure all data is flushed + if err := tmpFile.Close(); err != nil { + log.Println("[INFO] Error closing temporary file:", err) + // TODO raise error here + } + + log.Println("[INFO] Error FILENAME:", tmpFile.Name()) + + // Run the buf format command on the temporary file + cmd := exec.Command("buf", "format", tmpFile.Name()) + output, err := cmd.CombinedOutput() + if err != nil { + log.Printf("[INFO] Error running buf format: %v\nOutput:\n%s", err, string(output)) + // TODO raise error here + } + + outputString := string(output) + + if err != nil { + log.Fatalf("Error running buf command: %v", err) + } + + return outputString + +} + func schemaCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics @@ -231,11 +321,12 @@ func FromRegistryReferences(references []srclient.Reference) []interface{} { func ToSchemaType(schemaType interface{}) srclient.SchemaType { returnType := srclient.Avro - if schemaType == "json" { - returnType = srclient.Json - } - if schemaType == "protobuf" { - returnType = srclient.Protobuf + if schemaTypeStr, ok := schemaType.(string); ok { + if strings.ToLower(schemaTypeStr) == "json" { + returnType = srclient.Json + } else if strings.ToLower(schemaTypeStr) == "protobuf" { + returnType = srclient.Protobuf + } } return returnType From c5b025d762f0e63aec9739bdec30fe295a203f33 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Fri, 23 Aug 2024 11:04:18 -0500 Subject: [PATCH 05/27] test: modified test files to have an additional proto topic and schema to test locally against --- terraform-test-files/schema.tf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/terraform-test-files/schema.tf b/terraform-test-files/schema.tf index d5ec632..5c3a3c8 100644 --- a/terraform-test-files/schema.tf +++ b/terraform-test-files/schema.tf @@ -14,3 +14,20 @@ resource "schemaregistry_schema" "test_provider_topic_schema" { schema_type = "AVRO" subject = "provider-test-schema" } + +resource "kafka_topic" "test_provider_topic_proto" { + name = "provider-test-topic-proto" + partitions = 1 + replication_factor = 1 + config = { + "min.insync.replicas": "1" + } + provider= kafka.event-tracking-dev +} + +resource "schemaregistry_schema" "test_provider_topic_schema_proto" { + provider= schemaregistry.schema-registry-dev + schema = "syntax = \"proto3\";package com.fetchrewards.locationservice.proto;\n\n\noption java_outer_classname = \"FidoLocationTrackerProto\";\n\nmessage FidoLocationTracker {\n string location_id = 1;\n string fido = 2;}" + schema_type = "PROTOBUF" + subject = "provider-test-schema-proto" +} From 7aebaea0f2b9f9bf3e7f4365caf775e0062f4f22 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Fri, 23 Aug 2024 11:05:44 -0500 Subject: [PATCH 06/27] removed commented code in data_source_schema --- schemaregistry/data_source_schema.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/schemaregistry/data_source_schema.go b/schemaregistry/data_source_schema.go index 3da0f85..8fe8b9d 100644 --- a/schemaregistry/data_source_schema.go +++ b/schemaregistry/data_source_schema.go @@ -6,8 +6,6 @@ import ( "github.com/ashleybill/srclient" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - - // "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) From 91b6d43934bb54050bb0f3fc827227047b9fdb12 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:22:59 -0500 Subject: [PATCH 07/27] updated gitignore with test data files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b0c14b7..b50f2e3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ # Dependency directories (remove the comment below to include it) vendor/ +terraform-test-files/ + dist/ .vscode/ .idea/ From 2ae9498dedd9309bee976f9b91b9f5b6345c4450 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:23:25 -0500 Subject: [PATCH 08/27] updated go dependencies to include buf for formatting purposes --- go.mod | 39 ++++++++++++++++++++++----------- go.sum | 68 +++++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 70 insertions(+), 37 deletions(-) diff --git a/go.mod b/go.mod index 5c18211..9a11e2a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module terraform-provider-confluent-schema-registry -go 1.18 +go 1.21.0 + +toolchain go1.21.4 require ( github.com/ashleybill/srclient v0.6.3 @@ -8,13 +10,26 @@ require ( github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 ) +require ( + github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/bufbuild/buf v1.38.0 // indirect + github.com/bufbuild/protocompile v0.14.0 // indirect + github.com/gofrs/uuid/v5 v5.3.0 // indirect + github.com/jhump/protoreflect v1.16.0 // indirect + github.com/stretchr/testify v1.9.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect +) + require ( github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/fatih/color v1.13.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.1 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -29,7 +44,7 @@ require ( github.com/hashicorp/terraform-exec v0.18.1 // indirect github.com/hashicorp/terraform-json v0.16.0 // indirect github.com/hashicorp/terraform-plugin-go v0.14.3 // indirect - github.com/hashicorp/terraform-plugin-log v0.8.0 // indirect + github.com/hashicorp/terraform-plugin-log v0.8.0 github.com/hashicorp/terraform-registry-address v0.1.0 // indirect github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect @@ -47,14 +62,14 @@ require ( github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.13.1 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/mod v0.20.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect google.golang.org/appengine v1.6.6 // indirect google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect - google.golang.org/grpc v1.51.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/go.sum b/go.sum index 87b2e78..69e58d3 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,9 @@ github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy86 github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= @@ -23,6 +24,10 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/ashleybill/srclient v0.6.3 h1:1X7WTSWP1mLX9iG4UPtmnT2AgIXY8eiEMpMUTRXbbnY= github.com/ashleybill/srclient v0.6.3/go.mod h1:GYY/FVSsmFmLKX+WKFtRIkgiGptidEeQDlhwjSs5nfc= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bufbuild/buf v1.38.0 h1:k9zDnhemPC4E0h4BRshCL6mmQji6qzSHOJTG0iGW11o= +github.com/bufbuild/buf v1.38.0/go.mod h1:GNSjEtwLmhq6A3oCFu4De4ov8RtAvxM1H1x2BUjjnk8= +github.com/bufbuild/protocompile v0.14.0 h1:z3DW4IvXE5G/uTOnSQn+qwQQxvhckkTWLS/0No/o7KU= +github.com/bufbuild/protocompile v0.14.0/go.mod h1:N6J1NYzkspJo3ZwyL4Xjvli86XOj1xq4qAasUFxGups= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -47,6 +52,9 @@ github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6 github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= +github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -60,18 +68,17 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -127,7 +134,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= +github.com/jhump/protoreflect v1.16.0 h1:54fZg+49widqXYQ0b+usAFHbMkBGR4PpXrsHc8+TBDg= +github.com/jhump/protoreflect v1.16.0/go.mod h1:oYPd7nPvcBw/5wlDfm/AVmU9zH9BgqGCI469pGxfj/8= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -140,6 +148,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/linkedin/goavro/v2 v2.11.1 h1:4cuAtbDfqkKnBXp9E+tRkIJGa6W6iAjwonwt8O1f4U0= github.com/linkedin/goavro/v2 v2.11.1/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= @@ -179,6 +188,7 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 h1:TToq11gyfNlrMFZiYujSekIsPd9Am github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -190,8 +200,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -205,6 +216,14 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.13.1 h1:0a6bRwuiSHtAmqCqNOE+c2oHgepv0ctoxU4FUe43kwc= github.com/zclconf/go-cty v1.13.1/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -213,16 +232,16 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -239,8 +258,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -248,8 +267,9 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -270,8 +290,8 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= @@ -280,8 +300,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -304,8 +324,8 @@ google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6D google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -314,10 +334,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 6a54a0397cc41db8b11b1567ca8c880970823414 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:24:32 -0500 Subject: [PATCH 09/27] feat: updated test-new-build.sh with working commands --- test-new-build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/test-new-build.sh b/test-new-build.sh index 417d62f..4e1ffaa 100755 --- a/test-new-build.sh +++ b/test-new-build.sh @@ -1,5 +1,3 @@ -# make build -# cp dist/terraform-provider-schemaregistry ~/.terraform.d/plugins/local/fetch-rewards/confluent-schema-registry/1.1.0/linux_amd64/terraform-provider-confluent-schema-registry_1.1.0 make local_install cd terraform-test-files || exit rm -rf .terraform/providers From 4635b9550b89cd135225528f71ac8f43b88243bf Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:25:32 -0500 Subject: [PATCH 10/27] feat: updated resource_schema with proto formatting using buf directly --- schemaregistry/resource_schema.go | 123 ++++++++++-------------------- 1 file changed, 40 insertions(+), 83 deletions(-) diff --git a/schemaregistry/resource_schema.go b/schemaregistry/resource_schema.go index d6581c3..59b7a17 100644 --- a/schemaregistry/resource_schema.go +++ b/schemaregistry/resource_schema.go @@ -4,9 +4,6 @@ import ( "context" "fmt" "log" - "os" - "os/exec" - "regexp" "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" @@ -26,34 +23,39 @@ func resourceSchema() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - CustomizeDiff: customdiff.All( - customdiff.ComputedIf("version", func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool { - - var schemaHasChange bool - oldState, newState := d.GetChange("schema") - - if schemaTypeStr, ok := d.Get("schema_type").(string); ok { - if strings.ToLower(schemaTypeStr) == "json" { - newJSON, _ := structure.NormalizeJsonString(newState) - oldJSON, _ := structure.NormalizeJsonString(oldState) - schemaHasChange = newJSON != oldJSON - } else if strings.ToLower(schemaTypeStr) == "avro" { - newJSON, _ := structure.NormalizeJsonString(newState) - oldJSON, _ := structure.NormalizeJsonString(oldState) - schemaHasChange = newJSON != oldJSON - } else if strings.ToLower(schemaTypeStr) == "protobuf" { - newProtoString := formatProtoString(newState.(string)) - oldProtoString := formatProtoString(oldState.(string)) - - schemaHasChange = oldProtoString != newProtoString + CustomizeDiff: customdiff.ComputedIf("version", func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool { + + var schemaHasChange bool + oldState, newState := d.GetChange("schema") + + if schemaTypeStr, ok := d.Get("schema_type").(string); ok { + if strings.ToLower(schemaTypeStr) == "json" { + newJSON, _ := structure.NormalizeJsonString(newState) + oldJSON, _ := structure.NormalizeJsonString(oldState) + schemaHasChange = newJSON != oldJSON + } else if strings.ToLower(schemaTypeStr) == "avro" { + newJSON, _ := structure.NormalizeJsonString(newState) + oldJSON, _ := structure.NormalizeJsonString(oldState) + schemaHasChange = newJSON != oldJSON + } else if strings.ToLower(schemaTypeStr) == "protobuf" { + newProtoString, err := FormatProtobufString(newState.(string)) + if err != nil { + // If theres an error diff should be true, indicating something is wrong? + println("err") } + oldProtoString, err := FormatProtobufString(oldState.(string)) + if err != nil { + println("err") + } + + schemaHasChange = oldProtoString != newProtoString } - log.Printf("[INFO] Schemas Equal %t", schemaHasChange) - log.Printf("[INFO] Version Change %t", d.HasChange("version")) + } + log.Printf("[INFO] Schemas Equal %t", schemaHasChange) + log.Printf("[INFO] Version Change %t", d.HasChange("version")) - return schemaHasChange || d.HasChange("version") - }), - ), + return schemaHasChange || d.HasChange("version") + }), Schema: map[string]*schema.Schema{ "subject": { Type: schema.TypeString, @@ -78,8 +80,16 @@ func resourceSchema() *schema.Resource { oldJSON, _ := structure.NormalizeJsonString(old) schemaEquals = newJSON == oldJSON } else if strings.ToLower(schemaTypeStr) == "protobuf" { - newProtoString := formatProtoString(new) - oldProtoString := formatProtoString(old) + newProtoString, err := FormatProtobufString(new) + if err != nil { + println("err") + } + + oldProtoString, err := FormatProtobufString(old) + if err != nil { + println("err") + } + schemaEquals = newProtoString == oldProtoString } } @@ -130,59 +140,6 @@ func resourceSchema() *schema.Resource { } } -func formatProtoString(protoSchemaString string) string { - re := regexp.MustCompile(`\s+`) - protoSchemaString = re.ReplaceAllString(protoSchemaString, " ") - - // Create a custom temporary directory - // Have to create a custom tmp dir because otherwise the original one has incorrect permissions to create a temp file and then read it later - customTempDir := "./custom-temp" - if err := os.MkdirAll(customTempDir, 0755); err != nil { - log.Fatalf("Error creating custom temp directory: %v", err) - } - defer os.RemoveAll(customTempDir) // Clean up the directory afterwards - - // Create a temporary file - tmpFile, err := os.CreateTemp(customTempDir, "*.proto") - if err != nil { - log.Println("[INFO] Error creating temporary file:", err) - // TODO raise error here - } - - defer os.Remove(tmpFile.Name()) // Clean up the file afterwards - - // Write the protobuf string to the file - if _, err := tmpFile.WriteString(protoSchemaString); err != nil { - log.Println("[INFO] Error writing to temporary file:", err) - // TODO raise error here - } - - // Close the file to ensure all data is flushed - if err := tmpFile.Close(); err != nil { - log.Println("[INFO] Error closing temporary file:", err) - // TODO raise error here - } - - log.Println("[INFO] Error FILENAME:", tmpFile.Name()) - - // Run the buf format command on the temporary file - cmd := exec.Command("buf", "format", tmpFile.Name()) - output, err := cmd.CombinedOutput() - if err != nil { - log.Printf("[INFO] Error running buf format: %v\nOutput:\n%s", err, string(output)) - // TODO raise error here - } - - outputString := string(output) - - if err != nil { - log.Fatalf("Error running buf command: %v", err) - } - - return outputString - -} - func schemaCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics From 3e054f89b49dc039e8aa47686f1adeaa74cc8c11 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:28:16 -0500 Subject: [PATCH 11/27] test: updated test to pass with updated error text capitalization --- schemaregistry/resource_schema_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemaregistry/resource_schema_test.go b/schemaregistry/resource_schema_test.go index 1e55023..465c47c 100644 --- a/schemaregistry/resource_schema_test.go +++ b/schemaregistry/resource_schema_test.go @@ -137,7 +137,7 @@ func TestAccResourceSchema_updateIncompatible(t *testing.T) { }, { Config: fmt.Sprintf(fixtureCreateSchema, subject, fixtureAvro3), - ExpectError: regexp.MustCompile(`invalid "schema": incompatible`), + ExpectError: regexp.MustCompile(`invalid 'schema': Incompatible`), }, }, }) From 4ed99992ddeefa287372d9cdc2fb828409c1b464 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:29:00 -0500 Subject: [PATCH 12/27] feat: updated utils with proto formatting functions --- schemaregistry/utils.go | 112 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/schemaregistry/utils.go b/schemaregistry/utils.go index 15e7b57..682c390 100644 --- a/schemaregistry/utils.go +++ b/schemaregistry/utils.go @@ -1,5 +1,20 @@ package schemaregistry +import ( + "context" + "fmt" + "io" + "os" + "path/filepath" + "regexp" + "strings" + + "github.com/bufbuild/buf/private/buf/bufformat" + "github.com/bufbuild/buf/private/bufpkg/bufmodule" + "github.com/bufbuild/buf/private/pkg/storage/storageos" + "github.com/bufbuild/buf/private/pkg/tracing" +) + const IDSeparator = "___" func formatSchemaVersionID(subject string) string { @@ -9,3 +24,100 @@ func formatSchemaVersionID(subject string) string { func extractSchemaVersionID(id string) string { return id } + +// Create a temporary .proto file based on a proto schema string and return +// the path of the file which corresponds to the schema +func CreateTemporaryProtoFile(protoSchemaString string) (string, error) { + var tempFileName string = "" + customTempDir, err := os.MkdirTemp("", "proto-") + if err != nil { + return tempFileName, fmt.Errorf("error creating custom temp directory: %v", err) + } + + // I dont think we need this since we moved this to utils instead ans separated into 2 funcs. + // we can no long clean up the file at the end of the func, maybe at the end of the formatting one though + // defer os.RemoveAll(customTempDir) // Clean up the directory afterwards + + // Create a temporary file + tmpFile, err := os.CreateTemp(customTempDir, "*.proto") + if err != nil { + return tempFileName, fmt.Errorf("error creating temporary file: %v", err) + } + + // Write the protobuf string to the file + if _, err := tmpFile.WriteString(protoSchemaString); err != nil { + return tempFileName, fmt.Errorf("error writing to temporary file: %v", err) + } + + // Close the file to ensure all data is flushed + if err := tmpFile.Close(); err != nil { + return tempFileName, fmt.Errorf("error closing temporary file: %v", err) + } + + tempFileName = tmpFile.Name() + + return tempFileName, err +} + +func FormatProtobufString(protoSchemaString string) (string, error) { + var finalErr error = nil + var fileContent string = "" + + re := regexp.MustCompile(`\s+`) + protoSchemaString = re.ReplaceAllString(protoSchemaString, " ") + + // Need to add two new lines before message to take care of the case when the "option" line + // Does not have two lines after it, otherwise formatting is off + newProtoSchemaString := strings.ReplaceAll(protoSchemaString, "message", "\n\nmessage") + + fullFilepath, err := CreateTemporaryProtoFile(newProtoSchemaString) + + if err != nil { + return fileContent, fmt.Errorf("failed to create temporary proto file: %w", err) + } + + protoSchemaDir := filepath.Dir(fullFilepath) + fileName := filepath.Base(fullFilepath) //Need to split on '/' and get last element + + // Not sure what context is doing here other than a mandatory parameter + ctx := context.Background() + + bucket, err := storageos.NewProvider().NewReadWriteBucket(protoSchemaDir) + + if err != nil { + return fileContent, fmt.Errorf("failed to get proto file bucket: %w", err) + } + + moduleSetBuilder := bufmodule.NewModuleSetBuilder(ctx, tracing.NopTracer, bufmodule.NopModuleDataProvider, bufmodule.NopCommitProvider) + + moduleSetBuilder.AddLocalModule(bucket, protoSchemaDir, true) + + moduleSet, err := moduleSetBuilder.Build() + + if err != nil { + return fileContent, fmt.Errorf("failed to build proto file formatter: %w", err) + } + + // At this point all the files are formatted + readBucket, err := bufformat.FormatModuleSet(ctx, moduleSet) + + if err != nil { + return fileContent, fmt.Errorf("failed to format proto file: %w", err) + } + + obj, err := readBucket.Get(ctx, fileName) + if err != nil { + return fileContent, fmt.Errorf("failed to get formatted proto file '%s': %w", fullFilepath, err) + } + defer obj.Close() + + // Read the file content + content, err := io.ReadAll(obj) + if err != nil { + return fileContent, fmt.Errorf("failed to read formatted proto file contents: %w", err) + } + + fileContent = string(content) + + return fileContent, finalErr +} From 4b8b0c48374e90a10fad9700d1cd87e62fdf2ad4 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:29:19 -0500 Subject: [PATCH 13/27] test: added 3 tests for proto string formatting --- schemaregistry/utils_test.go | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 schemaregistry/utils_test.go diff --git a/schemaregistry/utils_test.go b/schemaregistry/utils_test.go new file mode 100644 index 0000000..962e7cf --- /dev/null +++ b/schemaregistry/utils_test.go @@ -0,0 +1,84 @@ +package schemaregistry + +import ( + "os" + "strings" + "testing" +) + +func TestCreateTemporaryProtoFile(t *testing.T) { + var protoSchemaString string = "syntax = \"proto3\";" + + protoFilePath, err := CreateTemporaryProtoFile(protoSchemaString) + if err != nil { + t.Fatal(err) + } + + t.Logf("\nFile Path: `%s`", protoFilePath) + + // Read from the tmp file and verify it matches the correct string + // Read the entire file content + content, err := os.ReadFile(protoFilePath) + if err != nil { + t.Fatal(err) + } + + // Convert the byte slice to a string + fileContent := string(content) + + t.Logf("\nFile Contents: `%s`", fileContent) + + if fileContent != protoSchemaString { + t.Errorf("File content does not match original str") + } + +} + +func TestBufFormatting(t *testing.T) { + originalProtoSchema := `syntax = "proto3";package com.fetchrewards.locationservice.proto;option java_outer_classname = "FidoLocationTrackerProto"; + + + message FidoLocationTracker { + string location_id = 1; + + + string fido = 2;} + + ` + formattedProtoSchema, err := FormatProtobufString(originalProtoSchema) + + if err != nil { + t.Error("Proto string formatter should not error") + } + + expectedProtoSchema := "syntax = \"proto3\";\n" + + "package com.fetchrewards.locationservice.proto;\n\n" + + "option java_outer_classname = \"FidoLocationTrackerProto\";\n\n" + + "message FidoLocationTracker {\n" + + " string location_id = 1;\n" + + " string fido = 2;\n" + + "}\n" + + if formattedProtoSchema != expectedProtoSchema { + t.Errorf( + "Formatted Proto Schema does not match expected Schema\nexpected:\n`%s`\n\nactual:\n`%s`", + expectedProtoSchema, + formattedProtoSchema, + ) + } +} + +func TestMalfromedProtoFileFormatting(t *testing.T) { + // Expect a file that is not actually a proto schema to have a nil pointer dereference exception error + originalProtoSchema := "Not a Protobuf schema" + formattedProtoSchema, err := FormatProtobufString(originalProtoSchema) + + if formattedProtoSchema != "" { + t.Error("Expected formatted proto schema to be an empty string") + } + + if !strings.Contains(err.Error(), "failed to format proto file") { + t.Errorf("expected error to contain 'failed to format proto file', but got: %v", err) + } + +} From 37495cee589460a970d3f8bfd60619c7ff213bd4 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 09:31:16 -0500 Subject: [PATCH 14/27] removed terraform-test-files from git --- terraform-test-files/provider.tf | 32 ------------------------------- terraform-test-files/schema.tf | 33 -------------------------------- 2 files changed, 65 deletions(-) delete mode 100644 terraform-test-files/provider.tf delete mode 100644 terraform-test-files/schema.tf diff --git a/terraform-test-files/provider.tf b/terraform-test-files/provider.tf deleted file mode 100644 index 0a4169f..0000000 --- a/terraform-test-files/provider.tf +++ /dev/null @@ -1,32 +0,0 @@ -terraform { - required_providers { - schemaregistry = { - source = "local/fetch-rewards/confluent-schema-registry" - version = "1.1.0" - } - - kafka = { - source = "mongey/kafka", - version = "0.5.3" - } - aws = { - source = "hashicorp/aws", - version = "5.21.0" - } - } -} - - -provider "schemaregistry" { - alias = "schema-registry-dev" - schema_registry_url = "https://dev-event-tracking-schema-registry.fetchrewards.com" -} - -provider "kafka" { - alias = "event-tracking-dev" - bootstrap_servers = [ - "dev-event-tracking-kafka.fetchrewards.com:9094" - ] - skip_tls_verify = true - tls_enabled = false -} \ No newline at end of file diff --git a/terraform-test-files/schema.tf b/terraform-test-files/schema.tf deleted file mode 100644 index 5c3a3c8..0000000 --- a/terraform-test-files/schema.tf +++ /dev/null @@ -1,33 +0,0 @@ -resource "kafka_topic" "test_provider_topic" { - name = "provider-test-topic" - partitions = 1 - replication_factor = 1 - config = { - "min.insync.replicas": "1" - } - provider= kafka.event-tracking-dev -} - -resource "schemaregistry_schema" "test_provider_topic_schema" { - provider= schemaregistry.schema-registry-dev - schema = "{\n\t\"type\": \"record\",\n\t\"name\": \"AwesomeEvent\",\n\t\"namespace\": \"com.fetchrewards.kia\",\n\t\"fields\": [\n\t\t{\n\t\t\t\"name\": \"id\",\n\t\t\t\"type\": \"int\",\n\t\t\t\"default\": \"null\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"eventType\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"updateTs\",\n\t\t\t\"type\": \"int\"\n\t\t}\n\t]\n}" - schema_type = "AVRO" - subject = "provider-test-schema" -} - -resource "kafka_topic" "test_provider_topic_proto" { - name = "provider-test-topic-proto" - partitions = 1 - replication_factor = 1 - config = { - "min.insync.replicas": "1" - } - provider= kafka.event-tracking-dev -} - -resource "schemaregistry_schema" "test_provider_topic_schema_proto" { - provider= schemaregistry.schema-registry-dev - schema = "syntax = \"proto3\";package com.fetchrewards.locationservice.proto;\n\n\noption java_outer_classname = \"FidoLocationTrackerProto\";\n\nmessage FidoLocationTracker {\n string location_id = 1;\n string fido = 2;}" - schema_type = "PROTOBUF" - subject = "provider-test-schema-proto" -} From 0d7aca03072afac8718afcc3d7550b117f9d98bb Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 14:20:46 -0500 Subject: [PATCH 15/27] updated go mod to include protocompile instead of buf cli --- go.mod | 9 +-------- go.sum | 12 ------------ 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 9a11e2a..e7b8aee 100644 --- a/go.mod +++ b/go.mod @@ -6,21 +6,14 @@ toolchain go1.21.4 require ( github.com/ashleybill/srclient v0.6.3 + github.com/bufbuild/protocompile v0.14.0 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 ) require ( github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/bufbuild/buf v1.38.0 // indirect - github.com/bufbuild/protocompile v0.14.0 // indirect - github.com/gofrs/uuid/v5 v5.3.0 // indirect github.com/jhump/protoreflect v1.16.0 // indirect - github.com/stretchr/testify v1.9.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect - go.uber.org/atomic v1.11.0 // indirect - go.uber.org/multierr v1.11.0 // indirect ) require ( diff --git a/go.sum b/go.sum index 69e58d3..28f8285 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,6 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/ashleybill/srclient v0.6.3 h1:1X7WTSWP1mLX9iG4UPtmnT2AgIXY8eiEMpMUTRXbbnY= github.com/ashleybill/srclient v0.6.3/go.mod h1:GYY/FVSsmFmLKX+WKFtRIkgiGptidEeQDlhwjSs5nfc= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bufbuild/buf v1.38.0 h1:k9zDnhemPC4E0h4BRshCL6mmQji6qzSHOJTG0iGW11o= -github.com/bufbuild/buf v1.38.0/go.mod h1:GNSjEtwLmhq6A3oCFu4De4ov8RtAvxM1H1x2BUjjnk8= github.com/bufbuild/protocompile v0.14.0 h1:z3DW4IvXE5G/uTOnSQn+qwQQxvhckkTWLS/0No/o7KU= github.com/bufbuild/protocompile v0.14.0/go.mod h1:N6J1NYzkspJo3ZwyL4Xjvli86XOj1xq4qAasUFxGups= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -53,8 +51,6 @@ github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= -github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -216,14 +212,6 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.13.1 h1:0a6bRwuiSHtAmqCqNOE+c2oHgepv0ctoxU4FUe43kwc= github.com/zclconf/go-cty v1.13.1/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= From cf3ae8bed95c0ddccb848a8b21c364887f733d86 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 14:21:30 -0500 Subject: [PATCH 16/27] feat: updated utils to use AST comparison instead of proto formatting --- schemaregistry/utils.go | 93 ++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 53 deletions(-) diff --git a/schemaregistry/utils.go b/schemaregistry/utils.go index 682c390..8a0e22d 100644 --- a/schemaregistry/utils.go +++ b/schemaregistry/utils.go @@ -1,18 +1,13 @@ package schemaregistry import ( - "context" "fmt" - "io" + "log" "os" - "path/filepath" - "regexp" - "strings" - - "github.com/bufbuild/buf/private/buf/bufformat" - "github.com/bufbuild/buf/private/bufpkg/bufmodule" - "github.com/bufbuild/buf/private/pkg/storage/storageos" - "github.com/bufbuild/buf/private/pkg/tracing" + "reflect" + + "github.com/bufbuild/protocompile/parser" + "github.com/bufbuild/protocompile/reporter" ) const IDSeparator = "___" @@ -59,65 +54,57 @@ func CreateTemporaryProtoFile(protoSchemaString string) (string, error) { return tempFileName, err } -func FormatProtobufString(protoSchemaString string) (string, error) { - var finalErr error = nil - var fileContent string = "" - - re := regexp.MustCompile(`\s+`) - protoSchemaString = re.ReplaceAllString(protoSchemaString, " ") - - // Need to add two new lines before message to take care of the case when the "option" line - // Does not have two lines after it, otherwise formatting is off - newProtoSchemaString := strings.ReplaceAll(protoSchemaString, "message", "\n\nmessage") - - fullFilepath, err := CreateTemporaryProtoFile(newProtoSchemaString) +// CompareASTs compares two AST nodes for equality +func CompareASTs(protoSchemaString1 string, protoSchemaString2 string) (bool, error) { + filePath1, err := CreateTemporaryProtoFile(protoSchemaString1) if err != nil { - return fileContent, fmt.Errorf("failed to create temporary proto file: %w", err) + return false, fmt.Errorf("failed to create temporary proto file: %w", err) } - protoSchemaDir := filepath.Dir(fullFilepath) - fileName := filepath.Base(fullFilepath) //Need to split on '/' and get last element - - // Not sure what context is doing here other than a mandatory parameter - ctx := context.Background() - - bucket, err := storageos.NewProvider().NewReadWriteBucket(protoSchemaDir) + filePath2, err := CreateTemporaryProtoFile(protoSchemaString2) if err != nil { - return fileContent, fmt.Errorf("failed to get proto file bucket: %w", err) + return false, fmt.Errorf("failed to create temporary proto file: %w", err) } - moduleSetBuilder := bufmodule.NewModuleSetBuilder(ctx, tracing.NopTracer, bufmodule.NopModuleDataProvider, bufmodule.NopCommitProvider) - - moduleSetBuilder.AddLocalModule(bucket, protoSchemaDir, true) - - moduleSet, err := moduleSetBuilder.Build() - + // Parse the .proto file + node1, err := parseProtoFile(filePath1) if err != nil { - return fileContent, fmt.Errorf("failed to build proto file formatter: %w", err) + return false, fmt.Errorf("error parsing .proto file: %v", err) } - // At this point all the files are formatted - readBucket, err := bufformat.FormatModuleSet(ctx, moduleSet) - + // Parse the .proto file + node2, err := parseProtoFile(filePath2) if err != nil { - return fileContent, fmt.Errorf("failed to format proto file: %w", err) + return false, fmt.Errorf("error parsing .proto file: %v", err) } - obj, err := readBucket.Get(ctx, fileName) + // Compare everything but the Name field since Name is the file path + newName := " " + node1.FileDescriptorProto().Name = &newName + node2.FileDescriptorProto().Name = &newName + + // Log INFO node1 and node 2 FileDescriptorProto().String to see differences + log.Printf("[INFO] Proto File Descriptor 1: %s", node1.FileDescriptorProto().String()) + log.Printf("[INFO] Proto File Descriptor 2: %s", node2.FileDescriptorProto().String()) + + // Use reflect.DeepEqual to compare the nodes + return reflect.DeepEqual(node1.FileDescriptorProto(), node2.FileDescriptorProto()), nil +} + +func parseProtoFile(filename string) (parser.Result, error) { + f, err := os.Open(filename) if err != nil { - return fileContent, fmt.Errorf("failed to get formatted proto file '%s': %w", fullFilepath, err) + return nil, err } - defer obj.Close() - - // Read the file content - content, err := io.ReadAll(obj) + defer func() { + _ = f.Close() + }() + errHandler := reporter.NewHandler(nil) + res, err := parser.Parse(filename, f, errHandler) if err != nil { - return fileContent, fmt.Errorf("failed to read formatted proto file contents: %w", err) + return nil, err } - - fileContent = string(content) - - return fileContent, finalErr + return parser.ResultFromAST(res, true, errHandler) } From 2553d01817f0615287695070e12696da20c53999 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 14:21:58 -0500 Subject: [PATCH 17/27] feat: updated resource_schema to use AST comparison instead of formatting string comparison --- schemaregistry/resource_schema.go | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/schemaregistry/resource_schema.go b/schemaregistry/resource_schema.go index 59b7a17..d39539d 100644 --- a/schemaregistry/resource_schema.go +++ b/schemaregistry/resource_schema.go @@ -38,20 +38,17 @@ func resourceSchema() *schema.Resource { oldJSON, _ := structure.NormalizeJsonString(oldState) schemaHasChange = newJSON != oldJSON } else if strings.ToLower(schemaTypeStr) == "protobuf" { - newProtoString, err := FormatProtobufString(newState.(string)) + schemaEquals, err := CompareASTs(newState.(string), oldState.(string)) if err != nil { // If theres an error diff should be true, indicating something is wrong? - println("err") - } - oldProtoString, err := FormatProtobufString(oldState.(string)) - if err != nil { - println("err") + log.Printf("[INFO] err") } - schemaHasChange = oldProtoString != newProtoString + schemaHasChange = !schemaEquals + } } - log.Printf("[INFO] Schemas Equal %t", schemaHasChange) + log.Printf("[INFO] Schemas Change %t", schemaHasChange) log.Printf("[INFO] Version Change %t", d.HasChange("version")) return schemaHasChange || d.HasChange("version") @@ -80,19 +77,21 @@ func resourceSchema() *schema.Resource { oldJSON, _ := structure.NormalizeJsonString(old) schemaEquals = newJSON == oldJSON } else if strings.ToLower(schemaTypeStr) == "protobuf" { - newProtoString, err := FormatProtobufString(new) - if err != nil { - println("err") - } + log.Printf("[INFO] Schemas new %s", new) + log.Printf("[INFO] Schemas old %s", old) + var err error + schemaEquals, err = CompareASTs(new, old) - oldProtoString, err := FormatProtobufString(old) + log.Printf("[INFO] Schemas equals %v", schemaEquals) if err != nil { - println("err") + // If theres an error diff should be true, indicating something is wrong? + log.Printf("[INFO] err %v", schemaEquals) } - - schemaEquals = newProtoString == oldProtoString } } + + log.Printf("[INFO] Schemas Equal %s %t", d.Get("schema_type").(string), schemaEquals) + return schemaEquals }, }, From a321dd426efa9625d1aa07de2c91b3d7c699c247 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 14:22:21 -0500 Subject: [PATCH 18/27] test: updated tests to use AST comparison instead of string formatting --- schemaregistry/utils_test.go | 68 ++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/schemaregistry/utils_test.go b/schemaregistry/utils_test.go index 962e7cf..a81af21 100644 --- a/schemaregistry/utils_test.go +++ b/schemaregistry/utils_test.go @@ -34,7 +34,7 @@ func TestCreateTemporaryProtoFile(t *testing.T) { } -func TestBufFormatting(t *testing.T) { +func TestProtoCompileASTComparison(t *testing.T) { originalProtoSchema := `syntax = "proto3";package com.fetchrewards.locationservice.proto;option java_outer_classname = "FidoLocationTrackerProto"; @@ -45,11 +45,6 @@ func TestBufFormatting(t *testing.T) { string fido = 2;} ` - formattedProtoSchema, err := FormatProtobufString(originalProtoSchema) - - if err != nil { - t.Error("Proto string formatter should not error") - } expectedProtoSchema := "syntax = \"proto3\";\n" + "package com.fetchrewards.locationservice.proto;\n\n" + @@ -59,25 +54,70 @@ func TestBufFormatting(t *testing.T) { " string fido = 2;\n" + "}\n" - if formattedProtoSchema != expectedProtoSchema { + schemaEquals, err := CompareASTs(originalProtoSchema, expectedProtoSchema) + + if err != nil { + t.Error("Proto string formatter should not error") + } + + if !schemaEquals { t.Errorf( - "Formatted Proto Schema does not match expected Schema\nexpected:\n`%s`\n\nactual:\n`%s`", + "Original Proto Schema does not match expected Schema\nexpected:\n`%s`\n\nactual:\n`%s`", + originalProtoSchema, expectedProtoSchema, - formattedProtoSchema, ) } } -func TestMalfromedProtoFileFormatting(t *testing.T) { +func TestProtoCompileASTComparisonFidoTracking(t *testing.T) { + newSchema := `syntax = "proto3";package com.fetchrewards.locationservice.proto; + + + option java_outer_classname = "FidoLocationTrackerProto"; + + message FidoLocationTracker { + string location_id = 1; + string fido = 2;} + + ` + + oldSchema := `syntax = "proto3"; + package com.fetchrewards.locationservice.proto; + + option java_outer_classname = "FidoLocationTrackerProto"; + + message FidoLocationTracker { + string location_id = 1; + string fido = 2; + }` + + schemaEquals, err := CompareASTs(newSchema, oldSchema) + + if err != nil { + t.Error("Proto string formatter should not error") + } + + if !schemaEquals { + t.Errorf( + "Original Proto Schema does not match expected Schema\nexpected:\n`%s`\n\nactual:\n`%s`", + newSchema, + oldSchema, + ) + } +} + +func TestMalformedProtoFileFormatting(t *testing.T) { // Expect a file that is not actually a proto schema to have a nil pointer dereference exception error originalProtoSchema := "Not a Protobuf schema" - formattedProtoSchema, err := FormatProtobufString(originalProtoSchema) + expectedProtoSchema := "Not a Protobuf schema" + + schemaEquals, err := CompareASTs(originalProtoSchema, expectedProtoSchema) - if formattedProtoSchema != "" { - t.Error("Expected formatted proto schema to be an empty string") + if schemaEquals { + t.Error("Expected schemaEquals to be false") } - if !strings.Contains(err.Error(), "failed to format proto file") { + if !strings.Contains(err.Error(), "error parsing .proto file") { t.Errorf("expected error to contain 'failed to format proto file', but got: %v", err) } From 1a01a0dfad7c91413c989d497ec8d40e28492e71 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 14:33:46 -0500 Subject: [PATCH 19/27] feat: removed unecessary logging --- schemaregistry/resource_schema.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/schemaregistry/resource_schema.go b/schemaregistry/resource_schema.go index d39539d..034437b 100644 --- a/schemaregistry/resource_schema.go +++ b/schemaregistry/resource_schema.go @@ -41,7 +41,7 @@ func resourceSchema() *schema.Resource { schemaEquals, err := CompareASTs(newState.(string), oldState.(string)) if err != nil { // If theres an error diff should be true, indicating something is wrong? - log.Printf("[INFO] err") + log.Printf("[ERROR] %v", err) } schemaHasChange = !schemaEquals @@ -77,21 +77,17 @@ func resourceSchema() *schema.Resource { oldJSON, _ := structure.NormalizeJsonString(old) schemaEquals = newJSON == oldJSON } else if strings.ToLower(schemaTypeStr) == "protobuf" { - log.Printf("[INFO] Schemas new %s", new) - log.Printf("[INFO] Schemas old %s", old) + log.Printf("[INFO] Schema new: \n`%s`", new) + log.Printf("[INFO] Schema old: \n`%s`", old) var err error schemaEquals, err = CompareASTs(new, old) - - log.Printf("[INFO] Schemas equals %v", schemaEquals) if err != nil { // If theres an error diff should be true, indicating something is wrong? - log.Printf("[INFO] err %v", schemaEquals) + log.Printf("[ERROR] schema %v", err) } } } - log.Printf("[INFO] Schemas Equal %s %t", d.Get("schema_type").(string), schemaEquals) - return schemaEquals }, }, From c3a8f7038ae785a66b55cb92776bb1c348904b48 Mon Sep 17 00:00:00 2001 From: Patrick Maziarz Date: Tue, 27 Aug 2024 14:48:29 -0500 Subject: [PATCH 20/27] feat: updated AST parser to use strins.NewReader instead of creating temp files --- schemaregistry/utils.go | 64 ++++-------------------------------- schemaregistry/utils_test.go | 29 ---------------- 2 files changed, 7 insertions(+), 86 deletions(-) diff --git a/schemaregistry/utils.go b/schemaregistry/utils.go index 8a0e22d..5006c8d 100644 --- a/schemaregistry/utils.go +++ b/schemaregistry/utils.go @@ -2,9 +2,10 @@ package schemaregistry import ( "fmt" + "io" "log" - "os" "reflect" + "strings" "github.com/bufbuild/protocompile/parser" "github.com/bufbuild/protocompile/reporter" @@ -20,62 +21,17 @@ func extractSchemaVersionID(id string) string { return id } -// Create a temporary .proto file based on a proto schema string and return -// the path of the file which corresponds to the schema -func CreateTemporaryProtoFile(protoSchemaString string) (string, error) { - var tempFileName string = "" - customTempDir, err := os.MkdirTemp("", "proto-") - if err != nil { - return tempFileName, fmt.Errorf("error creating custom temp directory: %v", err) - } - - // I dont think we need this since we moved this to utils instead ans separated into 2 funcs. - // we can no long clean up the file at the end of the func, maybe at the end of the formatting one though - // defer os.RemoveAll(customTempDir) // Clean up the directory afterwards - - // Create a temporary file - tmpFile, err := os.CreateTemp(customTempDir, "*.proto") - if err != nil { - return tempFileName, fmt.Errorf("error creating temporary file: %v", err) - } - - // Write the protobuf string to the file - if _, err := tmpFile.WriteString(protoSchemaString); err != nil { - return tempFileName, fmt.Errorf("error writing to temporary file: %v", err) - } - - // Close the file to ensure all data is flushed - if err := tmpFile.Close(); err != nil { - return tempFileName, fmt.Errorf("error closing temporary file: %v", err) - } - - tempFileName = tmpFile.Name() - - return tempFileName, err -} - // CompareASTs compares two AST nodes for equality func CompareASTs(protoSchemaString1 string, protoSchemaString2 string) (bool, error) { - filePath1, err := CreateTemporaryProtoFile(protoSchemaString1) - - if err != nil { - return false, fmt.Errorf("failed to create temporary proto file: %w", err) - } - - filePath2, err := CreateTemporaryProtoFile(protoSchemaString2) - - if err != nil { - return false, fmt.Errorf("failed to create temporary proto file: %w", err) - } // Parse the .proto file - node1, err := parseProtoFile(filePath1) + node1, err := protoStringToAST(protoSchemaString1) if err != nil { return false, fmt.Errorf("error parsing .proto file: %v", err) } // Parse the .proto file - node2, err := parseProtoFile(filePath2) + node2, err := protoStringToAST(protoSchemaString2) if err != nil { return false, fmt.Errorf("error parsing .proto file: %v", err) } @@ -93,16 +49,10 @@ func CompareASTs(protoSchemaString1 string, protoSchemaString2 string) (bool, er return reflect.DeepEqual(node1.FileDescriptorProto(), node2.FileDescriptorProto()), nil } -func parseProtoFile(filename string) (parser.Result, error) { - f, err := os.Open(filename) - if err != nil { - return nil, err - } - defer func() { - _ = f.Close() - }() +func protoStringToAST(protoSchemaString string) (parser.Result, error) { errHandler := reporter.NewHandler(nil) - res, err := parser.Parse(filename, f, errHandler) + var reader io.Reader = strings.NewReader(protoSchemaString) + res, err := parser.Parse(" ", reader, errHandler) if err != nil { return nil, err } diff --git a/schemaregistry/utils_test.go b/schemaregistry/utils_test.go index a81af21..6fe8a1b 100644 --- a/schemaregistry/utils_test.go +++ b/schemaregistry/utils_test.go @@ -1,39 +1,10 @@ package schemaregistry import ( - "os" "strings" "testing" ) -func TestCreateTemporaryProtoFile(t *testing.T) { - var protoSchemaString string = "syntax = \"proto3\";" - - protoFilePath, err := CreateTemporaryProtoFile(protoSchemaString) - if err != nil { - t.Fatal(err) - } - - t.Logf("\nFile Path: `%s`", protoFilePath) - - // Read from the tmp file and verify it matches the correct string - // Read the entire file content - content, err := os.ReadFile(protoFilePath) - if err != nil { - t.Fatal(err) - } - - // Convert the byte slice to a string - fileContent := string(content) - - t.Logf("\nFile Contents: `%s`", fileContent) - - if fileContent != protoSchemaString { - t.Errorf("File content does not match original str") - } - -} - func TestProtoCompileASTComparison(t *testing.T) { originalProtoSchema := `syntax = "proto3";package com.fetchrewards.locationservice.proto;option java_outer_classname = "FidoLocationTrackerProto"; From fc8abad9df8248dc7a2e8eabd547c71cbe11026d Mon Sep 17 00:00:00 2001 From: Ryan Clark <39035478+ryanjclark@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:40:35 -0500 Subject: [PATCH 21/27] chore: draft release --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index ffd30a0..f5df44e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -49,6 +49,6 @@ release: github: owner: "fetch-rewards" name: "terraform-provider-confluent-schema-registry" - # draft: true TODO after testing set this back to true + draft: true # after testing set this back to true changelog: skip: true From 7ee870e7f8a357449c5a00323e767166c5497032 Mon Sep 17 00:00:00 2001 From: Ryan Clark <39035478+ryanjclark@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:43:01 -0500 Subject: [PATCH 22/27] fix: version 2 --- .goreleaser.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index f5df44e..91bb0d9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,8 @@ # Visit https://goreleaser.com for documentation on how to customize this # behavior. +version: 2 + before: hooks: # this is just an example and not a requirement for provider building/publishing.. From 8c42d296284eccf9d8789eb2b10da8ca74840c8c Mon Sep 17 00:00:00 2001 From: Ryan Clark <39035478+ryanjclark@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:46:09 -0500 Subject: [PATCH 23/27] fix: remove draft flag --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 91bb0d9..996b386 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -51,6 +51,6 @@ release: github: owner: "fetch-rewards" name: "terraform-provider-confluent-schema-registry" - draft: true # after testing set this back to true + # draft: true # after testing set this back to true changelog: skip: true From 9aaec681877014e694df94ba70680042ffcaf78c Mon Sep 17 00:00:00 2001 From: Ryan Clark <39035478+ryanjclark@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:50:59 -0500 Subject: [PATCH 24/27] fix: remove changelog block --- .goreleaser.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 996b386..4ddd77f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -51,6 +51,3 @@ release: github: owner: "fetch-rewards" name: "terraform-provider-confluent-schema-registry" - # draft: true # after testing set this back to true -changelog: - skip: true From 353a5ca97b485525f5420bcb29b30e18ee23452a Mon Sep 17 00:00:00 2001 From: Ryan Clark <39035478+ryanjclark@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:54:43 -0500 Subject: [PATCH 25/27] chore: upgrade go --- go.mod | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e7b8aee..396b1b2 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module terraform-provider-confluent-schema-registry -go 1.21.0 - -toolchain go1.21.4 +go 1.23.0 require ( github.com/ashleybill/srclient v0.6.3 From 0198400b06b07e1190b72491a3fc45afbb9af799 Mon Sep 17 00:00:00 2001 From: Ryan Clark <39035478+ryanjclark@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:57:25 -0500 Subject: [PATCH 26/27] chore: upgrade releaser --- .github/workflows/release.yml | 4 ++-- go.mod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fac0731..2e0c005 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,10 +27,10 @@ jobs: PASSPHRASE: ${{ secrets.PASSPHRASE }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v6 with: version: latest args: release --clean env: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/go.mod b/go.mod index 396b1b2..d1cc4b4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module terraform-provider-confluent-schema-registry -go 1.23.0 +go 1.23 require ( github.com/ashleybill/srclient v0.6.3 From 857818bcabc11aa85fd6b98fd6c68ee9246bf7a6 Mon Sep 17 00:00:00 2001 From: Ryan Clark <39035478+ryanjclark@users.noreply.github.com> Date: Wed, 25 Sep 2024 09:08:16 -0500 Subject: [PATCH 27/27] chore: match go upgrade --- .github/workflows/release.yml | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e0c005..4409b60 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.21.0 - name: Import GPG key id: import_gpg diff --git a/go.mod b/go.mod index d1cc4b4..688d729 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module terraform-provider-confluent-schema-registry -go 1.23 +go 1.21.0 require ( github.com/ashleybill/srclient v0.6.3