Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CDEvents SDK to v0.4 #932

Merged
merged 4 commits into from
Sep 26, 2024

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Sep 25, 2024

Bumps the go-deps group with 6 updates in the / directory:

Package From To
cloud.google.com/go/pubsub 1.41.0 1.43.0
github.com/DataDog/datadog-api-client-go/v2 2.29.0 2.30.0
github.com/cdevents/sdk-go 0.3.2 0.4.1
github.com/getsentry/sentry-go 0.28.1 0.29.0
github.com/slok/go-http-metrics 0.12.0 0.13.0
github.com/xanzy/go-gitlab 0.107.0 0.109.0

Updates cloud.google.com/go/pubsub from 1.41.0 to 1.43.0

Commits
  • 58df9c3 chore(main): release pubsub 1.43.0 (#10714)
  • 6685397 chore(.github): pin golang.org/x/mod and golang.org/x/tools in renovate (#10835)
  • f0958b0 chore(all): update deps (#10834)
  • ce82b22 vertexai(test): add corpora_test in tokenizer module (#10784)
  • 8d008de feat(bigtable): add "TypeUnspecified" to represent an unspecified type (#10820)
  • caa826c feat(pubsub): allow trace extraction from protobuf message (#10827)
  • 48addbf fix(pubsub): add attributes before startSpan (#10800)
  • 79a0e11 fix(pubsub): close grpc streams on retry (#10624)
  • 02b2d12 feat(bigtable): Add client side metrics to feature flag (#10678)
  • 0d732cc fix(datastore): do not delay on final transaction attempt (#10824)
  • Additional commits viewable in compare view

Updates github.com/DataDog/datadog-api-client-go/v2 from 2.29.0 to 2.30.0

Release notes

Sourced from github.com/DataDog/datadog-api-client-go/v2's releases.

v2.30.0

What's Changed

Fixed

Added

Changed

Deprecated

Full Changelog: DataDog/datadog-api-client-go@v2.29.0...v2.30.0

Changelog

Sourced from github.com/DataDog/datadog-api-client-go/v2's changelog.

2.30.0 / 2024-09-04

Fixed

Added

Changed

Deprecated

Full Changelog: DataDog/datadog-api-client-go@v2.29.0...v2.30.0

Commits

Updates github.com/cdevents/sdk-go from 0.3.2 to 0.4.1

Release notes

Sourced from github.com/cdevents/sdk-go's releases.

v0.4.1

Implement CDEvents Spec v0.4, including:

  • support for custom events
  • support for custom schemas
  • basic support for links
  • support for multiple spec versions. v0.3 and v0.4 are currently supported

What's Changed

New Contributors

Full Changelog: cdevents/sdk-go@v0.3.2...v0.4.1

Commits
  • d5d4efc Bump golangci/golangci-lint-action in the actions group (#94)
  • d342ca1 Add support for schema_uri validation (#87)
  • bcd874f Bump github/codeql-action from 3.25.13 to 3.25.15 in the actions group (#90)
  • 1078d50 Bump github/codeql-action from 3.25.12 to 3.25.13 in the actions group (#89)
  • 5e81f23 Bump the actions group with 2 updates (#88)
  • 5792dda test with go 1.21 and 1.22 (#86)
  • 080d904 Update ci jobs and dependabot config (#84)
  • 935f556 Add support for custom events (#85)
  • 9ac1c56 Import spec v0.4 and add support for v0.4 Context (#83)
  • f8b8b91 Add specification packages (#78)
  • Additional commits viewable in compare view

Updates github.com/getsentry/sentry-go from 0.28.1 to 0.29.0

Release notes

Sourced from github.com/getsentry/sentry-go's releases.

0.29.0

The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.29.0.

Breaking Changes

  • Remove the sentrymartini integration (#861)
  • The WrapResponseWriter has been moved from the sentryhttp package to the internal/httputils package. If you've imported it previosuly, you'll need to copy the implementation in your project. (#871)

Features

  • Add new convenience methods to continue a trace and propagate tracing headers for error-only use cases. (#862)

    If you are not using one of our integrations, you can manually continue an incoming trace by using sentry.ContinueTrace() by providing the sentry-trace and baggage header received from a downstream SDK.

    hub := sentry.CurrentHub()
    sentry.ContinueTrace(hub, r.Header.Get(sentry.SentryTraceHeader), r.Header.Get(sentry.SentryBaggageHeader)),

    You can use hub.GetTraceparent() and hub.GetBaggage() to fetch the necessary header values for outgoing HTTP requests.

    hub := sentry.GetHubFromContext(ctx)
    req, _ := http.NewRequest("GET", "http://localhost:3000", nil)
    req.Header.Add(sentry.SentryTraceHeader, hub.GetTraceparent())
    req.Header.Add(sentry.SentryBaggageHeader, hub.GetBaggage())

Bug Fixes

  • Initialize HTTPTransport.limit if nil (#844)
  • Fix sentry.StartTransaction() returning a transaction with an outdated context on existing transactions (#854)
  • Treat Proxy-Authorization as a sensitive header (#859)
  • Add support for the http.Hijacker interface to the sentrynegroni package (#871)
  • Go version >= 1.23: Use value from http.Request.Pattern for HTTP transaction names when using sentryhttp & sentrynegroni (#875)
  • Go version >= 1.21: Fix closure functions name grouping (#877)

Misc

  • Collect span origins (#849)
Changelog

Sourced from github.com/getsentry/sentry-go's changelog.

0.29.0

The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.29.0.

Breaking Changes

  • Remove the sentrymartini integration (#861)
  • The WrapResponseWriter has been moved from the sentryhttp package to the internal/httputils package. If you've imported it previosuly, you'll need to copy the implementation in your project. (#871)

Features

  • Add new convenience methods to continue a trace and propagate tracing headers for error-only use cases. (#862)

    If you are not using one of our integrations, you can manually continue an incoming trace by using sentry.ContinueTrace() by providing the sentry-trace and baggage header received from a downstream SDK.

    hub := sentry.CurrentHub()
    sentry.ContinueTrace(hub, r.Header.Get(sentry.SentryTraceHeader), r.Header.Get(sentry.SentryBaggageHeader)),

    You can use hub.GetTraceparent() and hub.GetBaggage() to fetch the necessary header values for outgoing HTTP requests.

    hub := sentry.GetHubFromContext(ctx)
    req, _ := http.NewRequest("GET", "http://localhost:3000", nil)
    req.Header.Add(sentry.SentryTraceHeader, hub.GetTraceparent())
    req.Header.Add(sentry.SentryBaggageHeader, hub.GetBaggage())

Bug Fixes

  • Initialize HTTPTransport.limit if nil (#844)
  • Fix sentry.StartTransaction() returning a transaction with an outdated context on existing transactions (#854)
  • Treat Proxy-Authorization as a sensitive header (#859)
  • Add support for the http.Hijacker interface to the sentrynegroni package (#871)
  • Go version >= 1.23: Use value from http.Request.Pattern for HTTP transaction names when using sentryhttp & sentrynegroni (#875)
  • Go version >= 1.21: Fix closure functions name grouping (#877)

Misc

  • Collect span origins (#849)
Commits

Updates github.com/slok/go-http-metrics from 0.12.0 to 0.13.0

Release notes

Sourced from github.com/slok/go-http-metrics's releases.

v0.13.0

0.13.0 - 2024-09-05

Added

  • Added IgnoredPaths option to ignore measuring specific exact paths.

Changed

  • Dependency updates.
  • Use Go 1.23.
Changelog

Sourced from github.com/slok/go-http-metrics's changelog.

[0.13.0] - 2024-09-05

Added

  • Added IgnoredPaths option to ignore measuring specific exact paths.

Changed

  • Dependency updates.
  • Use Go 1.23.
Commits

Updates github.com/xanzy/go-gitlab from 0.107.0 to 0.109.0

Release notes

Sourced from github.com/xanzy/go-gitlab's releases.

v0.109.0

Breaking Changes

What's Changed

New Contributors

Full Changelog: xanzy/go-gitlab@v0.108.0...v0.109.0

v0.108.0

Breaking Changes

What's Changed

New Contributors

... (truncated)

Commits
  • afb6163 Merge pull request #2005 from mXtone/main
  • 21134f2 Fix typos for list methods - groups service accounts
  • 291685b Add support for groups service accounts
  • 658c4fd Merge pull request #2004 from RicePatrick/fix-default-branch-typo
  • f1d37ee Fix an issue with omitempty on default_branch_protection_defaults
  • 6b15a3b Merge pull request #2003 from habnux/main
  • a43dcb2 Switch to list
  • fa3f0b2 Merge pull request #2001 from mdevilliers/add_missing_rule_types
  • e9e9ee8 chore: add RuleType to ProjectApprovalRule
  • 315e1c6 Merge pull request #1999 from deepflame/feature/update-jira-integration
  • Additional commits viewable in compare view

Updates google.golang.org/api from 0.192.0 to 0.196.0

Release notes

Sourced from google.golang.org/api's releases.

v0.196.0

0.196.0 (2024-09-03)

Features

v0.195.0

0.195.0 (2024-08-28)

Features

v0.194.0

0.194.0 (2024-08-22)

Features

Bug Fixes

  • gen: Change HttpBody.Data from string to any for monitoring:v1 (#2744) (eda6a59), refs #2304

v0.193.0

0.193.0 (2024-08-20)

Features

Changelog

Sourced from google.golang.org/api's changelog.

0.196.0 (2024-09-03)

Features

0.195.0 (2024-08-28)

Features

0.194.0 (2024-08-22)

Features

Bug Fixes

  • gen: Change HttpBody.Data from string to any for monitoring:v1 (#2744) (eda6a59), refs #2304

0.193.0 (2024-08-20)

Features

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore <dependency name> major version will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
  • @dependabot ignore <dependency name> minor version will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
  • @dependabot ignore <dependency name> will close this group update PR and stop Dependabot creating any more for the specific de...

Description has been truncated

Bumps the go-deps group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [cloud.google.com/go/pubsub](https://github.com/googleapis/google-cloud-go) | `1.41.0` | `1.43.0` |
| [github.com/DataDog/datadog-api-client-go/v2](https://github.com/DataDog/datadog-api-client-go) | `2.29.0` | `2.30.0` |
| [github.com/cdevents/sdk-go](https://github.com/cdevents/sdk-go) | `0.3.2` | `0.4.1` |
| [github.com/getsentry/sentry-go](https://github.com/getsentry/sentry-go) | `0.28.1` | `0.29.0` |
| [github.com/slok/go-http-metrics](https://github.com/slok/go-http-metrics) | `0.12.0` | `0.13.0` |
| [github.com/xanzy/go-gitlab](https://github.com/xanzy/go-gitlab) | `0.107.0` | `0.109.0` |



Updates `cloud.google.com/go/pubsub` from 1.41.0 to 1.43.0
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](googleapis/google-cloud-go@pubsub/v1.41.0...pubsub/v1.43.0)

Updates `github.com/DataDog/datadog-api-client-go/v2` from 2.29.0 to 2.30.0
- [Release notes](https://github.com/DataDog/datadog-api-client-go/releases)
- [Changelog](https://github.com/DataDog/datadog-api-client-go/blob/master/CHANGELOG.md)
- [Commits](DataDog/datadog-api-client-go@v2.29.0...v2.30.0)

Updates `github.com/cdevents/sdk-go` from 0.3.2 to 0.4.1
- [Release notes](https://github.com/cdevents/sdk-go/releases)
- [Changelog](https://github.com/cdevents/sdk-go/blob/main/.goreleaser.yaml)
- [Commits](cdevents/sdk-go@v0.3.2...v0.4.1)

Updates `github.com/getsentry/sentry-go` from 0.28.1 to 0.29.0
- [Release notes](https://github.com/getsentry/sentry-go/releases)
- [Changelog](https://github.com/getsentry/sentry-go/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-go@v0.28.1...v0.29.0)

Updates `github.com/slok/go-http-metrics` from 0.12.0 to 0.13.0
- [Release notes](https://github.com/slok/go-http-metrics/releases)
- [Changelog](https://github.com/slok/go-http-metrics/blob/master/CHANGELOG.md)
- [Commits](slok/go-http-metrics@v0.12.0...v0.13.0)

Updates `github.com/xanzy/go-gitlab` from 0.107.0 to 0.109.0
- [Release notes](https://github.com/xanzy/go-gitlab/releases)
- [Changelog](https://github.com/xanzy/go-gitlab/blob/main/releases_test.go)
- [Commits](xanzy/go-gitlab@v0.107.0...v0.109.0)

Updates `google.golang.org/api` from 0.192.0 to 0.196.0
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](googleapis/google-api-go-client@v0.192.0...v0.196.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/pubsub
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/DataDog/datadog-api-client-go/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/cdevents/sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/getsentry/sentry-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/slok/go-http-metrics
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/xanzy/go-gitlab
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency label Sep 25, 2024
@darkowlzz darkowlzz force-pushed the dependabot/go_modules/go-deps-d2f960fbdc branch from 49c68e0 to 3585b77 Compare September 25, 2024 23:31
@darkowlzz
Copy link
Contributor

I had a look at the CDEvents related build failure due to an API breaking change

Error: internal/server/receiver_handlers.go:208:28: undefined: cdevents.NewFromJsonBytes

NewFromJsonBytes used to exist in https://github.com/cdevents/sdk-go/blob/v0.3.2/pkg/api/bindings.go#L164.
Going through the new version v0.4.1, that has been replaced with NewFromJsonBytesContext in https://github.com/cdevents/sdk-go/blob/v0.4.1/pkg/api/bindings.go#L188C6-L188C29 which now accepts an extra map[string]CDEventType argument.

Going through the changes, I found this document https://github.com/cdevents/sdk-go/blob/v0.4.1/docs/README.md which shows usage of NewFromJsonBytes from a new package "github.com/cdevents/sdk-go/pkg/api/v04" in the last code snippet of the document. Refer https://github.com/cdevents/sdk-go/blob/v0.4.1/pkg/api/v04/docs.go#L483-L487 for definition and docs about it. This fixes the build but the CDEvents test fail with the following error

{"level":"error","ts":"2024-09-26T04:34:09.828+0530","msg":"unable to validate payload","reconciler kind":"Receiver","name":"cdevents-receiver","namespace":"","error":"unable to validate CDEvent event: jsonschema validation failed with 'https://cdevents.dev/0.4.1/schema/change-merged-event#'\n- at '/context/type': value must be 'dev.cdevents.change.merged.0.2.0'","stacktrace":"github.com/fluxcd/notification-controller/internal/server.Test_handlePayload.func1.(*ReceiverServer).handlePayload.1\n\t/go/src/github.com/fluxcd/notification-controller/internal/server/receiver_handlers.go:113\ngithub.com/fluxcd/notification-controller/internal/server.Test_handlePayload.func1\n\t/go/src/github.com/fluxcd/notification-controller/internal/server/receiver_handler_test.go:813\ntesting.tRunner\n\t/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1690"}

As mentioned in the error message, this can be fixed by updating the CDEvents payload used in the test for context type from dev.cdevents.change.merged.0.1.2 to dev.cdevents.change.merged.0.2.0.

The following patch fixes the issue

diff --git a/internal/server/receiver_handler_test.go b/internal/server/receiver_handler_test.go
index e460f72..2125ee8 100644
--- a/internal/server/receiver_handler_test.go
+++ b/internal/server/receiver_handler_test.go
@@ -145,7 +145,7 @@ func Test_handlePayload(t *testing.T) {
                                        "id":            "5555",
                                        "source":        "github",
                                        "timestamp":     "2023-12-07T14:51:29.908479495Z",
-                                       "type":          "dev.cdevents.change.merged.0.1.2",
+                                       "type":          "dev.cdevents.change.merged.0.2.0",
                                },
                                "subject": map[string]string{
                                        "type": "change",
@@ -191,7 +191,7 @@ func Test_handlePayload(t *testing.T) {
                                        "id":            "5555",
                                        "source":        "github",
                                        "timestamp":     "2023-12-07T14:51:29.908479495Z",
-                                       "type":          "dev.cdevents.change.merged.0.1.2",
+                                       "type":          "dev.cdevents.change.merged.0.2.0",
                                },
                                "subject": map[string]string{
                                        "type": "change",
@@ -236,7 +236,7 @@ func Test_handlePayload(t *testing.T) {
                                        "id":            "5555",
                                        "source":        "github",
                                        "timestamp":     "2023-12-07T14:51:29.908479495Z",
-                                       "type":          "dev.cdevents.change.merged.0.1.2",
+                                       "type":          "dev.cdevents.change.merged.0.2.0",
                                },
                                "subject": map[string]string{
                                        "type": "change",
diff --git a/internal/server/receiver_handlers.go b/internal/server/receiver_handlers.go
index 558c608..5c3dfd7 100644
--- a/internal/server/receiver_handlers.go
+++ b/internal/server/receiver_handlers.go
@@ -32,6 +32,7 @@ import (
        "time"
 
        cdevents "github.com/cdevents/sdk-go/pkg/api"
+       cdevents04 "github.com/cdevents/sdk-go/pkg/api/v04"
        "github.com/fluxcd/pkg/apis/meta"
        "github.com/fluxcd/pkg/runtime/conditions"
        "github.com/go-logr/logr"
@@ -205,7 +206,7 @@ func (s *ReceiverServer) validate(ctx context.Context, receiver apiv1.Receiver,
                        return fmt.Errorf("unable to read CDEvent request body: %s", err)
                }
 
-               cdevent, err := cdevents.NewFromJsonBytes(b)
+               cdevent, err := cdevents04.NewFromJsonBytes(b)
                if err != nil {
                        return fmt.Errorf("unable to validate CDEvent event: %s", err)
                }

Signed-off-by: Stefan Prodan <[email protected]>
Signed-off-by: Stefan Prodan <[email protected]>
@stefanprodan stefanprodan changed the title build(deps): bump the go-deps group across 1 directory with 7 updates Update CDEvents SDK to v0.4 Sep 26, 2024
@stefanprodan stefanprodan merged commit b4a9933 into main Sep 26, 2024
6 checks passed
@stefanprodan stefanprodan deleted the dependabot/go_modules/go-deps-d2f960fbdc branch September 26, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants