Skip to content

Commit caadb82

Browse files
authored
update plugin dependencies (#170)
* update plugin dependencies * cleanup * add vendors * add build tags * use mage as build * fix Makefile * add plugin check with grafana check tool * change release pipeline * add CHANGELOG.md * fix CHANGELOG.md
1 parent 6f1a8ee commit caadb82

File tree

1,085 files changed

+60344
-38020
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,085 files changed

+60344
-38020
lines changed

.github/workflows/pr-checks-backend.yml

+4-21
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- 'vendor/**'
1010
- 'pkg/**'
1111
- '**/Makefile'
12-
- '**/Dockerfile'
12+
- '**/Magefile.go'
1313
pull_request:
1414
branches:
1515
- main
@@ -19,7 +19,7 @@ on:
1919
- 'vendor/**'
2020
- 'pkg/**'
2121
- '**/Makefile'
22-
- '**/Dockerfile'
22+
- '**/Magefile.go'
2323

2424
permissions:
2525
contents: read
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup Go
4040
uses: actions/setup-go@v5
4141
with:
42-
go-version: 1.21.6
42+
go-version-file: 'go.mod'
4343
check-latest: true
4444
cache: true
4545

@@ -62,27 +62,10 @@ jobs:
6262
- name: Setup Go
6363
uses: actions/setup-go@v5
6464
with:
65-
go-version: 1.21.6
65+
go-version-file: 'go.mod'
6666
check-latest: true
6767
cache: true
6868

6969
- name: run tests
7070
run: |
7171
make ${{ matrix.scenario }}
72-
73-
build:
74-
needs: test
75-
name: build
76-
runs-on: ubuntu-latest
77-
steps:
78-
- name: Code checkout
79-
uses: actions/checkout@v4
80-
81-
- uses: actions/cache@v4
82-
with:
83-
path: gocache-for-docker
84-
key: gocache-docker-${{ runner.os }}-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.mod') }}
85-
86-
- name: Build
87-
run: |
88-
make vl-backend-plugin-build

.github/workflows/pr-checks-frontend.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ jobs:
2626
run-check:
2727
name: check
2828
runs-on: ubuntu-latest
29-
strategy:
30-
matrix:
31-
scenario: ["make vl-frontend-plugin-build", "yarn test"]
3229
steps:
3330
- name: Code checkout
3431
uses: actions/checkout@v4
@@ -41,6 +38,5 @@ jobs:
4138
- name: Install all dependencies
4239
run: yarn install
4340

44-
- name: Run
45-
run: |
46-
${{ matrix.scenario }}
41+
- name: Run tests
42+
run: yarn test
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: check / plugin
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- '.github/workflows/pr-checks-plugin.yml'
8+
- 'go.*'
9+
- 'vendor/**'
10+
- 'pkg/**'
11+
- '**/Makefile'
12+
- '**/Magefile.go'
13+
- '**/Dockerfile'
14+
- '**/*.ts'
15+
- '**/*.tsx'
16+
- '**/yarn.lock'
17+
- '**/package.json'
18+
pull_request:
19+
branches:
20+
- main
21+
paths:
22+
- '.github/workflows/pr-checks-plugin.yml'
23+
- 'go.*'
24+
- 'vendor/**'
25+
- 'pkg/**'
26+
- '**/Makefile'
27+
- '**/Magefile.go'
28+
- '**/Dockerfile'
29+
- '**/*.ts'
30+
- '**/*.tsx'
31+
- '**/yarn.lock'
32+
- '**/package.json'
33+
34+
permissions:
35+
contents: read
36+
37+
concurrency:
38+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
39+
cancel-in-progress: true
40+
41+
jobs:
42+
build:
43+
name: build and validate
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Code checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Setup Go
50+
uses: actions/setup-go@v5
51+
with:
52+
go-version-file: 'go.mod'
53+
check-latest: true
54+
cache: true
55+
- name: Setup node caches
56+
uses: actions/cache@v4
57+
with:
58+
path: |
59+
${{ github.workspace }}/.cache
60+
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json') }}
61+
restore-keys: |
62+
${{ runner.os }}-yarn-
63+
64+
- name: Build
65+
run: |
66+
make vl-plugin-check

.github/workflows/pr-codeql-backend.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set up Go
3838
uses: actions/setup-go@v5
3939
with:
40-
go-version: 1.21.6
40+
go-version-file: 'go.mod'
4141
check-latest: true
4242
cache: true
4343
if: ${{ matrix.language == 'go' }}

.github/workflows/release.yaml

+8-9
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ jobs:
1616
steps:
1717
- name: Check out code
1818
uses: actions/checkout@v4
19-
- name: Setup golang caches
20-
uses: actions/cache@v4
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
2121
with:
22-
path: |
23-
${{ github.workspace }}/gocache-for-docker
24-
key: ${{ runner.os }}-golang-${{ hashFiles('go.sum') }}
25-
restore-keys: |
26-
${{ runner.os }}-golang-
22+
go-version-file: 'go.mod'
23+
check-latest: true
24+
cache: true
2725
- name: Setup node caches
2826
uses: actions/cache@v4
2927
with:
@@ -34,8 +32,9 @@ jobs:
3432
${{ runner.os }}-yarn-
3533
- name: Build plugin
3634
run: |
37-
yq -iP '.version="${{ env.PKG_TAG }}"' package.json -o json
38-
make vl-plugin-release
35+
export PKG_TAG="${PKG_TAG#v}"
36+
yq -iP '.version=env(PKG_TAG)' package.json -o json
37+
make vl-plugin-check
3938
- name: Prepare release notes
4039
run: |
4140
if grep -q "^## tip$" CHANGELOG.md; then

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
## tip
44

5+
6+
* FEATURE: update plugin dependencies to satisfy Grafana marketplace requirements.
7+
58
* BUGFIX: filter out empty variable values in queries. See [this issue](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/159).
69

10+
711
## v0.13.0
812

913
⚠️ **Breaking Change: Plugin ID Updated**
File renamed without changes.

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright {yyyy} {name of copyright owner}
189+
Copyright 2024 VictoriaMetrics
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

Magefile.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//go:build mage
2+
// +build mage
3+
4+
package main
5+
6+
import (
7+
// mage:import
8+
"github.com/grafana/grafana-plugin-sdk-go/build"
9+
)
10+
11+
func init() {
12+
build.SetBeforeBuildCallback(func(cfg build.Config) (build.Config, error) {
13+
// Do something before building
14+
cfg.OutputBinaryPath = "plugins/victoriametrics-logs-datasource"
15+
return cfg, nil
16+
})
17+
}
18+
19+
// Default configures the default target.
20+
var Default = build.BuildAll

Makefile

+25-34
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,30 @@ GO_BUILDINFO = -X 'github.com/grafana/grafana-plugin-sdk-go/build.buildInfoJSON=
1616

1717
.PHONY: $(MAKECMDGOALS)
1818

19-
include deployment/*/Makefile
20-
21-
app-via-docker-linux-amd64:
22-
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 $(MAKE) app-via-docker
23-
24-
app-via-docker-linux-arm:
25-
CGO_ENABLED=0 GOOS=linux GOARCH=arm $(MAKE) app-via-docker
26-
27-
app-via-docker-linux-386:
28-
CGO_ENABLED=0 GOOS=linux GOARCH=386 $(MAKE) app-via-docker
29-
30-
app-via-docker-linux-arm64:
31-
DOCKER_OPTS='--env CC=/opt/cross-builder/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc' CGO_ENABLED=1 GOOS=linux GOARCH=arm64 $(MAKE) app-via-docker
32-
33-
app-via-docker-darwin-amd64:
34-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(MAKE) app-via-docker
35-
36-
app-via-docker-darwin-arm64:
37-
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(MAKE) app-via-docker
38-
39-
app-via-docker-windows-arm64:
40-
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 $(MAKE) app-via-docker
41-
42-
app-via-docker-windows-amd64:
43-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(MAKE) app-via-docker
19+
frontend-package-base-image:
20+
docker build -t frontent-builder-image -f Dockerfile $(shell pwd)
21+
22+
frontend-build: frontend-package-base-image
23+
mkdir -p .npm .cache && \
24+
chown -R $(shell id -u):$(shell id -g) .npm .cache && \
25+
docker run --rm \
26+
-v "$(shell pwd):/victorialogs-datasource" \
27+
-v "$(shell pwd)/.yarn:/.yarn" \
28+
-v "$(shell pwd)/.npm:/.npm" \
29+
-v "$(shell pwd)/.cache:/.cache" \
30+
-w /victorialogs-datasource \
31+
--user $(shell id -u):$(shell id -g) \
32+
--env YARN_CACHE_FOLDER="/victorialogs-datasource/.cache" \
33+
--entrypoint=/bin/bash \
34+
frontent-builder-image -c "yarn install --omit=dev && yarn build"
4435

4536
app-via-docker-local:
4637
$(eval OS := $(shell docker run $(GO_BUILDER_IMAGE) go env GOOS))
4738
$(eval ARCH := $(shell docker run $(GO_BUILDER_IMAGE) go env GOARCH))
4839
$(MAKE) app-via-docker-$(OS)-$(ARCH)
4940

50-
vl-backend-plugin-build: \
51-
app-via-docker-linux-amd64 \
52-
app-via-docker-linux-arm \
53-
app-via-docker-linux-arm64 \
54-
app-via-docker-linux-386 \
55-
app-via-docker-darwin-amd64 \
56-
app-via-docker-darwin-arm64 \
57-
app-via-docker-windows-amd64 \
58-
app-via-docker-windows-arm64
41+
vl-backend-plugin-build:
42+
which mage || go install github.com/magefile/[email protected] && mage -v
5943

6044
vl-frontend-plugin-build: frontend-build
6145

@@ -102,3 +86,10 @@ vet:
10286
go vet ./pkg/...
10387

10488
check-all: fmt vet golang-ci-lint
89+
90+
vl-plugin-check-install:
91+
which plugincheck2 || go install github.com/grafana/plugin-validator/pkg/cmd/[email protected]
92+
93+
vl-plugin-check: vl-plugin-release vl-plugin-check-install
94+
$(eval PACKAGE_NAME := $(PLUGIN_ID)-$(PKG_TAG)) \
95+
plugincheck2 -sourceCodeUri file://$(shell pwd)/ "$(shell pwd)/dist/${PACKAGE_NAME}.zip"

deployment/docker/Makefile

-64
This file was deleted.

deployment/docker/base/Dockerfile

-10
This file was deleted.

deployment/docker/builder/Dockerfile

-9
This file was deleted.

0 commit comments

Comments
 (0)