mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Drone: Fix grafana-mixin linting (#28308)
* Drone: Fix Starlark script Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * grafana-mixin: Move build logic to scripts Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Drone: Use mixin scripts Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * CI build image: Install jsonnetfmt and mixtool Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Makefile: Print commands Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
|
||||
|
||||
all: fmt lint build clean
|
||||
|
||||
fmt:
|
||||
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
||||
xargs -n 1 -- $(JSONNET_FMT) -i
|
||||
./scripts/format.sh
|
||||
|
||||
lint:
|
||||
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
||||
while read f; do \
|
||||
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \
|
||||
done
|
||||
|
||||
mixtool lint mixin.libsonnet
|
||||
./scripts/lint.sh
|
||||
|
||||
build:
|
||||
mixtool generate all mixin.libsonnet
|
||||
./scripts/build.sh
|
||||
|
||||
clean:
|
||||
rm -rf dashboards_out alerts.yaml rules.yaml
|
||||
rm -rf dashboards_out alerts.yaml rules.yaml
|
||||
|
||||
6
grafana-mixin/scripts/build.sh
Executable file
6
grafana-mixin/scripts/build.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
mixtool generate all mixin.libsonnet
|
||||
1
grafana-mixin/scripts/common.sh
Normal file
1
grafana-mixin/scripts/common.sh
Normal file
@@ -0,0 +1 @@
|
||||
JSONNET_FMT="jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s"
|
||||
9
grafana-mixin/scripts/format.sh
Executable file
9
grafana-mixin/scripts/format.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
. scripts/common.sh
|
||||
|
||||
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
||||
xargs -n 1 -- ${JSONNET_FMT} -i
|
||||
13
grafana-mixin/scripts/lint.sh
Executable file
13
grafana-mixin/scripts/lint.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
. scripts/common.sh
|
||||
|
||||
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
||||
while read f; do \
|
||||
${JSONNET_FMT} "$f" | diff -u "$f" -; \
|
||||
done
|
||||
|
||||
mixtool lint mixin.libsonnet
|
||||
Reference in New Issue
Block a user