Chore: Add cuefix hook (#61941)

* Add cue

* Add fix-cue target

* Add pre-commit hook

* fixup! Add fix-cue target

* Update the cue version

* Add datasources and panels folders

* Update cue files

Co-authored-by: Tania B <yalyna.ts@gmail.com>
This commit is contained in:
Selene 2023-01-24 02:36:46 +01:00 committed by GitHub
parent f5743ea9ac
commit 6f26333e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 69 additions and 9 deletions

View File

@ -23,6 +23,12 @@ $(BRA): $(BINGO_DIR)/bra.mod
@echo "(re)installing $(GOBIN)/bra-v0.0.0-20200517080246-1e3013ecaff8"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=bra.mod -o=$(GOBIN)/bra-v0.0.0-20200517080246-1e3013ecaff8 "github.com/unknwon/bra"
CUE := $(GOBIN)/cue-v0.5.0-beta.2
$(CUE): $(BINGO_DIR)/cue.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/cue-v0.5.0-beta.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=cue.mod -o=$(GOBIN)/cue-v0.5.0-beta.2 "cuelang.org/go/cmd/cue"
DRONE := $(GOBIN)/drone-v1.5.0
$(DRONE): $(BINGO_DIR)/drone.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.

5
.bingo/cue.mod Normal file
View File

@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
go 1.19
require cuelang.org/go v0.5.0-beta.2 // cmd/cue

30
.bingo/cue.sum Normal file
View File

@ -0,0 +1,30 @@
cuelang.org/go v0.4.3 h1:W3oBBjDTm7+IZfCKZAmC8uDG0eYfJL4Pp/xbbCMKaVo=
cuelang.org/go v0.4.3/go.mod h1:7805vR9H+VoBNdWFdI7jyDR3QLUPp4+naHfbcgp55HI=
cuelang.org/go v0.5.0-beta.2 h1:am5M7jGvNTJ0rnjrFNyvE7fucL/wRqb0emK4XxdThQI=
cuelang.org/go v0.5.0-beta.2/go.mod h1:okjJBHFQFer+a41sAe2SaGm1glWS8oEb6CmJvn5Zdws=
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
github.com/cockroachdb/apd/v2 v2.0.1 h1:y1Rh3tEU89D+7Tgbw+lp52T6p/GJLpDmNvr10UWqLTE=
github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E=
github.com/emicklei/proto v1.6.15 h1:XbpwxmuOPrdES97FrSfpyy67SSCV/wBIKXqgJzh6hNw=
github.com/emicklei/proto v1.10.0 h1:pDGyFRVV5RvV+nkBK9iy3q67FBy9Xa7vwrOTE+g5aGw=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de h1:D5x39vF5KCwKQaw+OC9ZPiLVHXz3UFw2+psEX+gYcto=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc h1:gSVONBi2HWMFXCa9jFdYvYk7IwW/mTLxWOF7rXS4LO0=
github.com/protocolbuffers/txtpbfmt v0.0.0-20220428173112-74888fd59c2b h1:zd/2RNzIRkoGGMjE+YIsZ85CnDIz672JK2F3Zl4vux4=
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449 h1:xUIPaMhvROX9dhPvRCenIJtU78+lbEenGbgqB5hfHCQ=
golang.org/x/mod v0.6.0-dev.0.20220818022119-ed83ed61efb9 h1:VtCrPQXM5Wo9l7XN64SjBMczl48j8mkP+2e3OhYlz+0=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/tools v0.0.0-20200612220849-54c614fe050c h1:g6oFfz6Cmw68izP3xsdud3Oxu145IPkeFzyRg58AKHM=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -10,6 +10,8 @@ fi
BRA="${GOBIN}/bra-v0.0.0-20200517080246-1e3013ecaff8"
CUE="${GOBIN}/cue-v0.5.0-beta.2"
DRONE="${GOBIN}/drone-v1.5.0"
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.50.1"

View File

@ -7,12 +7,13 @@ WIRE_TAGS = "oss"
-include local/Makefile
include .bingo/Variables.mk
.PHONY: all deps-go deps-js deps build-go build-backend build-server build-cli build-js build build-docker-full build-docker-full-ubuntu lint-go golangci-lint test-go test-js gen-ts test run run-frontend clean devenv devenv-down protobuf drone help gen-go gen-cue
.PHONY: all deps-go deps-js deps build-go build-backend build-server build-cli build-js build build-docker-full build-docker-full-ubuntu lint-go golangci-lint test-go test-js gen-ts test run run-frontend clean devenv devenv-down protobuf drone help gen-go gen-cue fix-cue
GO = go
GO_FILES ?= ./pkg/...
SH_FILES ?= $(shell find ./scripts -name *.sh)
GO_BUILD_FLAGS += $(if $(GO_BUILD_DEV),-dev)
GO_BUILD_FLAGS += $(if $(GO_BUILD_DEV),-dev)
GO_BUILD_FLAGS += $(if $(GO_BUILD_TAGS),-build-tags=$(GO_BUILD_TAGS))
all: deps build
@ -75,6 +76,11 @@ gen-go: $(WIRE) gen-cue
@echo "generate go files"
$(WIRE) gen -tags $(WIRE_TAGS) ./pkg/server ./pkg/cmd/grafana-cli/runner
fix-cue: $(CUE)
@echo "formatting cue files"
$(CUE) fix kinds/**/*.cue
$(CUE) fix public/app/plugins/**/**/*.cue
gen-jsonnet:
go generate ./devenv/jsonnet

View File

@ -8,7 +8,8 @@ maturity: "experimental"
lineage: seqs: [
{
schemas: [
{// 0.0
// 0.0
{
@grafana(TSVeneer="type")
// Unique numeric identifier for the dashboard.
@ -506,6 +507,7 @@ lineage: seqs: [
}
...
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
#HeatmapPanel: {
type: "heatmap" @grafanamaturity(NeedsExpertReview)
...

View File

@ -1,12 +1,13 @@
package kind
name: "Playlist"
name: "Playlist"
maturity: "merged"
lineage: seqs: [
{
schemas: [
{//0.0
//0.0
{
// Unique playlist identifier. Generated on creation, either by the
// creator of the playlist of by the application.
uid: string
@ -39,9 +40,9 @@ lineage: seqs: [
value: string
// Title is an unused property -- it will be removed in the future
title?: string
title?: string
} @cuetsy(kind="interface")
}
},
]
}
},
]

View File

@ -1,6 +1,6 @@
package kind
name: "Team"
name: "Team"
maturity: "merged"
lineage: seqs: [
@ -21,7 +21,9 @@ lineage: seqs: [
// TODO - it seems it's a team_member.permission, unlikely it should belong to the team kind
permission: #Permission @grafanamaturity(ToMetadata="kind", MaybeRemove)
// AccessControl metadata associated with a given resource.
accessControl?: [string]: bool @grafanamaturity(ToMetadata="sys")
accessControl?: {
[string]: bool @grafanamaturity(ToMetadata="sys")
}
// Created indicates when the team was created.
created: int64 @grafanamaturity(ToMetadata="sys")
// Updated indicates when the team was updated.

View File

@ -71,6 +71,12 @@
],
"*pkg/**/*.go": [
"gofmt -w -s"
],
"*kinds/**/*.cue": [
"make fix-cue"
],
"*public/app/plugins/**/**/*.cue": [
"make fix-cue"
]
},
"devDependencies": {