Conversation
|
|
83f75dd to
f510c8a
Compare
|
Would love to see this released! Adding deployment annotations to our dashboards would be a great feature. Main reason I would install this plugin. |
| // GetAllDeployments retrieves every deployment from a repository | ||
| func GetAllDeployments(ctx context.Context, client models.Client, opts models.ListDeploymentsOptions) (DeploymentsWrapper, error) { | ||
| if opts.Owner == "" || opts.Repository == "" { | ||
| return nil, nil |
There was a problem hiding this comment.
Keeping (nil, nil) here for consistency with other list functions. Same pattern in workflows: https://github.com/grafana/github-datasource/blob/main/pkg/github/workflows.go#L54-L56
pkg/github/deployments.go
Outdated
|
|
||
| for _, deployment := range deployments { | ||
| createdAt := deployment.CreatedAt.GetTime() | ||
| if createdAt != nil && !createdAt.Before(from) && !createdAt.After(to) { |
There was a problem hiding this comment.
| if createdAt != nil && !createdAt.Before(from) && !createdAt.After(to) { | |
| if createdAt := deployment.CreatedAt.GetTime(); createdAt != nil && !createdAt.Before(from) && !createdAt.After(to) { |
potential nil pointer?
.changeset/cozy-guests-bake.md
Outdated
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| 'grafana-github-datasource': patch | |||
There was a problem hiding this comment.
Bumped this to minor instead of patch.
Why?
Resolves #254
Users (and our squad) need to monitor GitHub deployments across different environments (e.g., production, staging) to track which version/hash has been rolled out. Our particular usecase is having Annotation queries to visualize when deployments have hit/made it into production. This is far from perfect but hopefully it's a good enough start.
What?
deploymentsquery type to support querying GitHub deployments via REST APIGetAllDeploymentsfunction inpkg/github/deployments.gowith support for filtering by SHA, ref, task, and environmentGetDeploymentsInRangefunction to filter deployments by time rangeDeploymentsWrapper.Frames()to convert deployments to Grafana DataFrames with fields: id, sha, ref, task, environment, description, creator, created_at, updated_at, url, statuses_urlListDeploymentsmethod tomodels.Clientinterface inpkg/models/client.goDeploymentsQueryandListDeploymentsOptionsmodels inpkg/models/query.goandpkg/models/deployments.goQueryEditorDeploymentsReact component insrc/views/QueryEditorDeployments.tsxwith filter inputs for SHA, ref, task, and environmentpkg/github/deployments_handler.goandpkg/github/query_handler.gopkg/github/datasource.go,pkg/plugin/datasource.go, andpkg/plugin/datasource_caching.gosrc/constants.tsand update query types insrc/types/query.tssrc/views/QueryEditor.tsxpkg/github/deployments_test.gocovering GetAllDeployments, filtering, time range queries, and DataFrame conversionpkg/testutil/client.goto support deploymentsdocs/sources/query/_index.mdpatchchangeset entry for the new feature