Check that code has been formatted. (#9012)

pull/8958/head^2
Karsten Jeschkies 2 years ago committed by GitHub
parent de2b0c6e9d
commit ea8376d0cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .devcontainer/devcontainer.json
  2. 3
      .drone/drone.jsonnet
  3. 50
      .drone/drone.yml
  4. 11
      Makefile

@ -1,5 +1,5 @@
{
"image": "grafana/loki-build-image:0.28.1",
"image": "grafana/loki-build-image:0.28.2",
"containerEnv": {
"BUILD_IN_CONTAINER": "false"
},

@ -558,6 +558,9 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
},
make('loki', container=false) { depends_on: ['check-generated-files'] },
make('check-doc', container=false) { depends_on: ['loki'] },
make('check-format', container=false, args=[
'GIT_TARGET_BRANCH="$DRONE_TARGET_BRANCH"',
]) { depends_on: ['loki'], when: onPRs },
make('validate-example-configs', container=false) { depends_on: ['loki'] },
make('check-example-config-doc', container=false) { depends_on: ['clone'] },
{

@ -93,14 +93,14 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: check-drone-drift
- commands:
- make BUILD_IN_CONTAINER=false check-generated-files
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: check-generated-files
- commands:
- cd ..
@ -110,7 +110,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: clone-target-branch
when:
event:
@ -121,7 +121,7 @@ steps:
- clone-target-branch
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: test
- commands:
- cd ../loki-target-branch
@ -129,7 +129,7 @@ steps:
depends_on:
- clone-target-branch
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: test-target-branch
when:
event:
@ -142,7 +142,7 @@ steps:
- test
- test-target-branch
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: compare-coverage
when:
event:
@ -160,7 +160,7 @@ steps:
TOKEN:
from_secret: github_token
USER: grafanabot
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: report-coverage
when:
event:
@ -170,7 +170,7 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: lint
- commands:
- make BUILD_IN_CONTAINER=false check-mod
@ -178,7 +178,7 @@ steps:
- test
- lint
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: check-mod
- commands:
- apk add make bash && make lint-scripts
@ -189,28 +189,38 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: loki
- commands:
- make BUILD_IN_CONTAINER=false check-doc
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: check-doc
- commands:
- make BUILD_IN_CONTAINER=false check-format GIT_TARGET_BRANCH="$DRONE_TARGET_BRANCH"
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.28.2
name: check-format
when:
event:
- pull_request
- commands:
- make BUILD_IN_CONTAINER=false validate-example-configs
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: validate-example-configs
- commands:
- make BUILD_IN_CONTAINER=false check-example-config-doc
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: check-example-config-doc
- commands:
- mkdir -p /hugo/content/docs/loki/latest
@ -243,7 +253,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: loki-mixin-check
when:
event:
@ -268,7 +278,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: documentation-helm-reference-check
trigger:
ref:
@ -1419,7 +1429,7 @@ steps:
NFPM_SIGNING_KEY:
from_secret: gpg_private_key
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: write-key
- commands:
- make BUILD_IN_CONTAINER=false packages
@ -1427,7 +1437,7 @@ steps:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: test packaging
- commands:
- ./tools/packaging/verify-deb-install.sh
@ -1453,7 +1463,7 @@ steps:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: publish
when:
event:
@ -1487,7 +1497,7 @@ steps:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
image: grafana/loki-build-image:0.28.1
image: grafana/loki-build-image:0.28.2
name: build and push
privileged: true
volumes:
@ -1730,6 +1740,6 @@ kind: secret
name: gpg_private_key
---
kind: signature
hmac: 13bbbea8c92a338ef58fbc741ac9a8798fc50b8cd2893c1836214342ed1319c5
hmac: 3ccc42237f6cdd3de6afacf997575dafa52c9d5fee83cd3fee610e5fd365a283
...

@ -1,5 +1,6 @@
.DEFAULT_GOAL := all
.PHONY: all images check-generated-files logcli loki loki-debug promtail promtail-debug loki-canary lint test clean yacc protos touch-protobuf-sources format
.PHONY: all images check-generated-files logcli loki loki-debug promtail promtail-debug loki-canary lint test clean yacc protos touch-protobuf-sources
.PHONY: format check-format
.PHONY: docker-driver docker-driver-clean docker-driver-enable docker-driver-push
.PHONY: fluent-bit-image, fluent-bit-push, fluent-bit-test
.PHONY: fluentd-image, fluentd-push, fluentd-test
@ -30,7 +31,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES))
BUILD_IN_CONTAINER ?= true
# ensure you run `make drone` after changing this
BUILD_IMAGE_VERSION := 0.28.1
BUILD_IMAGE_VERSION := 0.28.2
# Docker image info
IMAGE_PREFIX ?= grafana
@ -742,6 +743,12 @@ format:
find . $(DONT_FIND) -name '*.pb.go' -prune -o -name '*.y.go' -prune -o -name '*.rl.go' -prune -o \
-type f -name '*.go' -exec goimports -w -local github.com/grafana/loki {} \;
GIT_TARGET_BRANCH ?= main
check-format: format
git diff --name-only HEAD origin/$(GIT_TARGET_BRANCH) -- "*.go" | xargs --no-run-if-empty git diff --exit-code -- \
|| (echo "Please format code by running 'make format' and committing the changes" && false)
# Documentation related commands
doc: ## Generates the config file documentation

Loading…
Cancel
Save