feat: Add deployments query type
#610
Open
+719
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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