Commit Graph

99 Commits

Author SHA1 Message Date
sam boyer
cc4d18f626
kindsys: Include composable kinds and planned maturity in report (#60477)
kindsys: Include composable kinds + planned maturity
2022-12-19 09:14:51 +01:00
Joan López de la Franca Beltran
61cd9eeb24
Kinds: Generate JSON report (#59742)
* Kinds: Generate JSON report

* Kinds: Add Validate/Write support for JSON report

* Kinds: Report format

* Kinds: Report new line

* Kinds: Use kindsys.SomeKindMeta to generate the report

* Move kinds report generation to the end

* Re-structure kinds report JSON output

* Make prettier to ignore kinds json report

* Minor on kinds report generation

* Fix toggles_gen test
2022-12-12 15:47:19 +01:00
Dan Cech
440d8a3d88
Build: Drone starlark file cleanup (#59919)
* format drone starlark files with black

* clean up unused params

* more simplification

* more cleanup

* more cleanup
2022-12-07 09:13:57 +02:00
Marcus Andersson
7f92f1df00
Schema: Refactor plugin code generation (#58901)
* wip

* wip

* almost there..

* wip - change so it can run.

* treelist is working.

* support CODEGEN_VERIFY env variable

* use log.fatal

* comment out old PluginTreeList code generation

* cleanup

* rename corelist package files

* fix makefile

* move pkg/codegen/pluggen.go to pkg/plugins/codegen

* copy and refactor files to pkg/plugins/codegen

* use pkg/plugins/codegen instead of pkg/codegen for core plugins code gen

* remove unneeded files

* remove unused code to resolve linting errors

* adapters first hack

* added flattener

* add back ignore build tags to go generate file

* cleaned up the code a bit.

* seems to work, needs to do some refactoring of the GoTypesJenns and TSTypesJenny.

* one more step, going to get upstream changes in this branch.

* working but need to run import tmpl in jenny_schemapath to have the proper imports.

* added header to generated files.

* added missing jenny.

* preventing plugins with multiple decls/schemas to insert multiple lines in corelist.

* fixed so we use Slot type from kindsys to detect if its group.

* adding a go jenny that only runs if the plugin has a backend.

* added version object to generated ts.

* generating the ts types with the same output as prior to this refactoring.

* removed code that is replaced by the jenny pattern.

* removed the go code that isn't used anymore.

* removed some more unused code and renamed pluggen to util_ts

* fixed linting issue.

* removed unused vars.

* use a jenny list postprocessor for header injection

* moved decl and decl_parser to pfs.

* removed the pre-pended header in the gotypes jenny since it is done in the postprocess.

* moved decl to pfs.

* removed unused template.

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-12-02 08:22:28 +01:00
Dan Cech
7436872dab
Build: Unified dockerfile for all builds (#59173)
* unified dockerfile for all builds

* update builder

* include docker commands and output in logs

* quiet docker build

* quiet gsutil
2022-11-28 16:18:53 -05:00
Dan Cech
9fec54df2d
Build: Streamline and sync dockerfiles (#58101)
* streamline and sync dockerfiles

* improve go dependency cacheability

* unify alpine and ubuntu Dockerfiles

* include glibc support in locally-built alpine images
2022-11-28 14:43:42 -05:00
Dan Cech
de99ce139c
Server: Switch from separate server & cli to a unified grafana binary (#58286)
* avoid the need for a second bulky binary for grafana-cli

* look for grafana-server in $PATH as well as same directory

* implement unified "grafana" command

* update dockerfiles, fix grafana-cli -v

* update packaging to work with single binary

- add wrapper scripts for grafana and grafana-server
- update and sync package files
- implement --sign flag of build package command
- stop packaging scripts folder, they are not useful for end users
- add support for --configOverrides in server command
- remove unused nfpm.yaml config file

* windows support
2022-11-22 11:53:43 -05:00
sam boyer
78f0340031
plugindef: Move pluginmeta out of coremodels as standalone thema lineage (#56765)
* Get pluginmeta mostly moved over to pkg/plugins/plugindef

* Remove dead func

* Fix up pfs, use sync.Once in plugindef

* Update to latest thema

* Chase Endec->Codec conversion in Thema

* Comments on slash header gen; use ToSlash

* Also generate JSON schema for plugindef

* Generate JSON Schema as well

* Fix slot loading from kindsys cue decls

* Remove unused vars

* skip generating plugin.schema.json for now

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-11-15 14:48:31 +01:00
Todd Treece
c090de9ed9
Chore: Move dev-dashboards jsonnet into separate directory (#58619) 2022-11-11 04:19:29 -05:00
sam boyer
07e5f8117f
Reconcile coremodels, entities, objects under new kind framework (#56492)
* Update thema to latest

* Deal with s/Library/*Runtime/

* Commit new, working results of codegen

* We like pointers now

* Always take runtime arg for NewBase()

* Sketchy handwavy pass at entity meta framework

* Little nibbles

* Update pkg/framework/coremodel/entityframework.cue

Co-authored-by: Artur Wierzbicki <wierzbicki.artur.94@gmail.com>

* Move file into new framework location

* Introduce loaders, Go code

* Complete rename to kind

* Flesh out framework, add svg/dashboard examples

* Cruft removal

* Remove generated kind go files from gitignore

* Refine maturity concept, add SlotKind

* Update embed and go deps

* Export PrefixWithGrafanaCUE

* Make the loader actually work, holy crap

* Many small tweaks to type.cue

* Add Apache 2 licensing exceptions for kinds

* Add new kinds dir, start of generator

* Roll back to earlier oapi-codegen

* Introduce new grafana-specific CUE loaders

* Introduce new tidy code generators framework

* Catch up kind framework with tinkering

* Add slices for the generators

* Add write/verify step to main generator

* Many renames

* Split up kind framework cue files

* Use kind.Decl within generated kinds

* Create kind.SomeDecl wrapper type to cache lineages

* Better names again

* Get one generated implemented, hopefully

* Copy dashboard schema into new kind.cue

* Small fixes to make the initial gen work

* Put svg kind in its new home

* Add generated Go dashboard type

* More renames and cleanups

* Add base kind registry and generator

* Stop blacklisting *_gen.go files

This is not the Go best practice, anyway. All we actually want to ignore
for enterprise is generated wire files.

* Change codegen output directories

pkg/kind -> pkg/kinds
pkg/registry/kindreg -> pkg/registry/corekind

* Rename pkg/framework/kind to pkg/kindsys

* Add core structured kind generator

* Add plural and machine names to kind spec

* Copy playlist over to kind system

* Consolidate kindsys files

* Add raw kind generator

* Update CODEOWNERS for kind framework

* Touch up comments a bit

* More docs tweaks

* Remove generated types to reduce noise for review

* Split each generator into its own file

* Rename Slot kind to Composable kind

* Add handwavy types for customkind loading

* Guard against init calls to framework loader

* First pass at doc on extending the kind system

* Improve attribute example in docs

* Fix wire imports

* Add basic TS types generator

* Fix composable kind category def

* No need for a separate file with generate directive

* Catch dashboard schema up

* Rename generator types to something saner and generic

* Make version configurable in ts/go generators

* Add CommonMeta to ease property access

* Add kindsys prop indicating whether lineage is group

* Put all kind categories back in a single file

* Finish with kindsys group props

* Refactor maturity progression per discussion

- Replace "committed" with "merged"
- All kindcats can use all maturity levels, at least for now

* Convert ts veneer index generator to modular system

* Move over to new jennywrites framework

* Strip down old coremodel generator

* Use public version of jennywrites

* Pull latest thema

* Commit generated Go types

* Add header injection postprocessor

* Move sdboyer/jennywrites to grafana/codejen

* Tweak header output

* Remove dashboard and playlist coremodels

* Fix up backend dashboards devenv test

* Fix TS import patterns to new gen filename

* Update internal imports, remove coremodel registry

* Fix compilation errors, wire generation

* Export and replace the prefix dropper

* More Go struct and field name changes

* Last name fixes, hopefully

* Fix lint errors

* Last lint error

Co-authored-by: Artur Wierzbicki <wierzbicki.artur.94@gmail.com>
2022-11-10 12:36:40 -08:00
Todd Treece
e105b5a107
Chore: Add jsonnet library for devenv dashboards (#57928) 2022-11-03 11:04:39 -04:00
Josh Hunt
2e16d5499e
Dashboard: Add dashboard validation warning to save drawer (#55732)
* add api route for validating a dashboard json

* add feature flag for showDashboardValidationWarnings

* tidy up

* comments and messages

* swagger specs

* fix typo

* more swagger

* tests!

* tidy test a little bit

* no more ioutil

* api will return different status code depending on validation error

* clean up

* handle 4xx errors

* remove console.log

* fix backend tests

* tidy up

* Swagger: Exclude alpha endpoints

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2022-10-14 09:51:05 -04:00
Sofia Papagiannaki
4cdbfb7606
Chore: Timeout integration package tests faster (#56287) 2022-10-10 09:27:04 +02:00
Emil Tullstedt
b287047052
Chore: Upgrade Go to 1.19.1 (#54902)
* WIP

* Set public_suffix to a pre Ruby 2.6 version

* we don't need to install python

* Stretch->Buster

* Bump versions in lib.star

* Manually update linter

Sort of messy, but the .mod-file need to contain all dependencies that
use 1.16+ features, otherwise they're assumed to be compiled with
-lang=go1.16 and cannot access generics et al.

Bingo doesn't seem to understand that, but it's possible to manually
update things to get Bingo happy.

* undo reformatting

* Various lint improvements

* More from the linter

* goimports -w ./pkg/

* Disable gocritic

* Add/modify linter exceptions

* lint + flatten nested list

Go 1.19 doesn't support nested lists, and there wasn't an obvious workaround.
https://go.dev/doc/comment#lists
2022-09-12 12:03:49 +02:00
linoman
3f0beee362
Update README build references (#54394) 2022-08-29 16:36:06 +02:00
lean.dev
e8e7b59bb0
Implementing OpenApi 3 specs (converted from Swagger 2) (#53243)
* Adding OpenApi target to makefile, to covert swagger spec into OpenAPI 3
* Adding endpoint to server swaggerui with new openapi3 specs
* Passing output file as parameter for OpenApi3 specs
* Implement workaround for missing host and prefix domain
2022-08-04 13:51:12 -03:00
Sofia Papagiannaki
3713a193d8
Chore: Fix Makefile target dependency (#53165) 2022-08-02 19:42:48 +03:00
Sofia Papagiannaki
3f58e8ec2a
Chore: Cleanup Makefile (#53037)
Remove redundant reference to deleted folder pkg/api/docs/definitions
2022-08-01 16:31:49 +03:00
Sofia Papagiannaki
7ba076de10
Chore: Move swagger definitions to the handlers (#52643) 2022-07-27 09:54:37 -04:00
Sofia Papagiannaki
f7c5eceb21
Chore: Update to the latest grafana-plugin-sdk-go and more swagger fixes (#52445)
* Fix get legacy alert response

* Swagger: Fix get folder by UID response

* Fix conflicting swagger model Alert

Reanme legacy alerting swagger model to LegacyAlert to differentiate it
from the prometheus Alert

* Bump grafana-plugin-sdk-go

* Fix get folder response

* Use go-swagger command for merging the specifications and remove merge_specs script
2022-07-20 16:09:42 +03:00
Kat Yang
ab8ad1bb42
Chore: Add new go test commands for unit, integration, and pro tests to makefile (#51202)
* Chore: Add new go test commands for unit, integration tests to makefile

* Add test-go-unit and test-go-integration targets as dependencies of the test-go target

* Add makefile target for mysql & postgres backends

* Set GRAFANA_TEST_DB variable for the xargs postgres command

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Set GRAFANA_TEST_DB variable for the xargs mysql command

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Use postgres_tests as source

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Set postgres_tests as source

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Clean test cache before postgres and mysql integration test makefile commands

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2022-07-19 11:04:38 +03:00
Sofia Papagiannaki
a5924315f8
API: Fix failure to generate swagger specification due to missing binary (#51551)
* Fix swagger generation

Add installing binary as dependency to the target

* Some more fixes
2022-06-30 09:58:07 +03:00
Sofia Papagiannaki
1399ab50b3
API: Universal swagger generation (#51033) 2022-06-27 10:54:31 +03:00
ying-jeanne
62531715b3
Chore: remove bra and scripts/go from grafana (#51130) 2022-06-21 11:08:08 +02:00
ying-jeanne
4489f331b8
Chore: Use the bingo built golangci-lint (#51048)
* use the bingo built golangci-lint

* remove grapl usage

* add dependancy
2022-06-17 19:46:20 +02:00
sam boyer
c8239a3a73
dev: Ignore generated go files in bra (#50889) 2022-06-15 16:33:40 +01:00
sam boyer
4c4aa95d38
coremodels: Automatically generate coremodel registries (#50057)
* coremodel: Generate static registry

* Actually make codegen work

Also, remove the per-coremodel assignability test from generator set.

* Make wire gen depend on cue gen

This is necessary now that we're generating a wire set as part of
coremodel registry generation.

* Add wire inject bits to http server

* s/staticregistry/registry/

* move to static and dynamic wording

* Move registry type into registry package

* Use static registry in http handler

* Oi comments
2022-06-15 15:47:04 +02:00
Sofia Papagiannaki
7418a80264
API: Make Swagger specification more consistent (#50576)
* Fix swagger generation targer using mac

Validate using the swagger binarry instead of the docker container

* API: Make swagger specification more consistent

Fix operation parameter ordering
2022-06-14 12:35:22 +02:00
Sofia Papagiannaki
a165b40e56
API: Fix swagger generation (#50071)
* API: Fix Swagger generation using docker

* Unset SWAGGER_GENERATE_EXTENSION for Mac
2022-06-03 13:31:14 +03:00
Sofia Papagiannaki
6112bd0c63
API: Fix swagger specification (#50034)
* API: Fix swagger specification

* Validate specification after generation
2022-06-02 10:49:52 +03:00
sam boyer
be06d37a20
schema: Generate Go and Typescript from Thema coremodels (#49193)
* Add go code generator for coremodels

* Just generate the entire coremodel for now

Maybe we'll need more flexibility as more coremodels are added, but for
now this is fine.

* Add note on type comment about stability, grodkit

* Remove local replace directive for thema

* Generate typescript from coremodel

* Update pkg/coremodel/dashboard/addenda.go

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

* Update cuetsy to new release

* Update thema to latest

* Fix enum generation for FieldColorModeId

* Put main generated object at the end of the file

* Tweaks to generated Go output

* Retweak back to var

* Add generated coremodel test

* Remove local replace statement again

* Add Make target and call into cuetsy cmd from gen

* Rename and comment linsrc for readability

* Move key codegen bits into reusable package

* Move body of cuetsifier into codegen pkg

Also genericize the diffing output into reusable WriteDiffer.

* Refactor coremodel generator to use WriteDiffer

* Add gen-cue step to CI

* Whip all the codegen automation into shape

* Add simplistic coremodel canonicality controls

* Remove erroneously committed test

* Bump thema version

* Remove dead code

* Improve wording of non-canonicality comment

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2022-05-27 03:21:37 +02:00
Alexander Weaver
ac8951f689
Alerting: Add support for documenting which alerting APIs are stable (#49018)
* Support for documenting stable vs unstable alerting routes

* empty commit, restart drone

* Touch-up references in root makefile and drop trailing escape newline

* Rebase and regenerate

* Extend README with docs for this change
2022-05-23 14:08:27 -05:00
Dan Cech
5c3308c6f3
add ability to pass builds flags/tags to go via make, update bra config (#46787) 2022-04-01 19:01:05 -04:00
Sofia Papagiannaki
2983082eb3
API: Fix missing enterprise routes in swagger spec (#45152) 2022-02-09 15:31:43 +01:00
Sofia Papagiannaki
35fe58de37
API: Extract OpenAPI specification from source code using go-swagger (#40528)
* API: Using go-swagger for extracting OpenAPI specification from source code

* Merge Grafana Alerting spec

* Include enterprise endpoints (if enabled)

* Serve SwaggerUI under feature flag

* Fix building dev docker images

* Configure swaggerUI

* Add missing json tags

Co-authored-by: Ying WANG <ying.wang@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-02-08 13:38:43 +01:00
Leonard Gram
c6021c8b4f
Build: building a local docker image using build-docker-dev no longer supported (#42563) 2021-12-01 14:34:28 +01:00
malcolmholmes
9c0a2a19fd
Package release before publishing (#42218)
* Package separately to publish

* Fix interpolation

* Windows format envvars

* More descriptive msg

* Won't publish from here

* Resolve docker issues in PR build

* Rename package docker step

* Correct npm release JSON structure
2021-11-30 10:53:07 +00:00
Joan López de la Franca Beltran
d49230d291
Grafana CLI Wire Runner (#41012)
* Set up Wire build graph

* Remove enterprise Wire set

* Move runner package outside commands

* Update Makefile (gen-go path)

* Minor prettier fix

* Include new Wire enterprise file into .gitignore

* Update Wire deps

* Update the grabpl version

Co-authored-by: Dan Cech <dcech@grafana.com>
2021-11-17 20:43:09 +01:00
Alexander Emelin
4cd2575ad0
Live: generate ts definitions for pipeline configs (#41544)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-11-15 22:45:35 +03:00
Dimitris Sotirakis
2b2c0b8b5e
Remove check for local drone version (#41535) 2021-11-12 14:08:43 +00:00
Dimitris Sotirakis
624d7631e6
Build/CI: Make integration-tests depend on initialize (#40782)
* Make integration tests depend on initialize

* Reorder steps for better visualisation
2021-10-21 22:28:57 +02:00
Dimitris Sotirakis
89e7a56714
Makefile: Force use drone-cli 1.4.0 version (#40385)
* Force use drone-cli 1.4.0

* Small modifications to prevent null generation

* Sign drone

* Use bingo to declare drone-cli version

* Update message in Makefile

* Update to latest grabpl version
2021-10-14 16:02:45 +02:00
kay delaney
b2e94d0733
Chore: Migrate yarn from v1 to v2 (#39082)
* Chore: Migrate yarn from v1 to v2

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
2021-10-08 15:19:10 +01:00
Yuriy Tseretyan
428f32bcf9
fix makefile to make lint-go command visibile in help (#39256) 2021-09-21 10:30:47 -04:00
Arve Knudsen
78596a6756
Migrate to Wire for dependency injection (#32289)
Fixes #30144

Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
Co-authored-by: spinillos <selenepinillos@gmail.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: Leonard Gram <leo@xlson.com>
2021-08-25 15:11:22 +02:00
Will Browne
8a2f63ee06
Update Makefile (#37926) 2021-08-17 12:06:33 +02:00
Dimitris Sotirakis
e4779cfb4f
Remove pkg-archive from Makefile (#37821) 2021-08-12 11:39:09 +03:00
Julien Duchesne
f41f00dec4
Sign Drone's configuration YAML file (#36528)
* Sign Drone's configuration YAML file
This is needed to protect the repository

* Update grabpl to 2.2.8

* Add comment about generating the drone.yml file
2021-07-14 14:40:28 +02:00
Serge Zaitsev
93cd375ada
remove GO111MODULE (#36235) 2021-06-29 10:01:21 +02:00
Dimitris Sotirakis
d3e510e92f
Chore: Remove Revive standalone linter - use it via golangci-lint (#33150)
* Remove Revive standalone linter - use it via golangci-lint

* Add revive settings to ignore lint errors for now

* Small fix

* Update to grabpl v0.5.53

* Remove errorCode and warningCode from config
2021-04-20 16:51:08 +02:00