Skip to content

Commit 5404ea0

Browse files
marefraknuds1
andauthored
Plugin: Create and sign plugin manifest (#152)
Closes #141 Co-authored-by: Arve Knudsen <[email protected]>
1 parent d63ceb0 commit 5404ea0

File tree

2 files changed

+78
-97
lines changed

2 files changed

+78
-97
lines changed

.circleci/config.yml

Lines changed: 76 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 2
1+
version: 2.1
22

33
aliases:
44
- &filter-not-release-or-master
@@ -15,6 +15,18 @@ defaults: &defaults
1515
docker:
1616
- image: circleci/node:12.13.1-stretch
1717

18+
commands:
19+
install-grabpl:
20+
description: "Install Grafana build pipeline tool"
21+
steps:
22+
- run:
23+
name: "Install Grafana build pipeline tool"
24+
command: |
25+
VERSION=0.4.22
26+
curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v${VERSION}/grabpl
27+
chmod +x grabpl
28+
mv grabpl /tmp
29+
1830
jobs:
1931
build:
2032
<<: *defaults
@@ -39,59 +51,17 @@ jobs:
3951
paths:
4052
- build/*
4153

42-
package_linux_x64:
43-
<<: *defaults
44-
steps:
45-
- checkout
46-
- attach_workspace:
47-
at: .
48-
- restore_cache:
49-
keys:
50-
- dependency-cache-{{ checksum "yarn.lock" }}
51-
- run:
52-
name: Install dependencies
53-
command: 'yarn install --pure-lockfile --no-progress'
54-
- run:
55-
name: Package
56-
command: './scripts/package_target.sh linux-x64-glibc'
57-
- run:
58-
name: Archive
59-
command: './scripts/archive_target.sh linux-x64-glibc'
60-
- persist_to_workspace:
61-
root: .
62-
paths:
63-
- dist/*
64-
- artifacts/*
65-
- store_artifacts:
66-
path: artifacts
67-
68-
package_darwin_x64:
69-
<<: *defaults
70-
steps:
71-
- checkout
72-
- attach_workspace:
73-
at: .
74-
- restore_cache:
75-
keys:
76-
- dependency-cache-{{ checksum "yarn.lock" }}
77-
- run:
78-
name: Install dependencies
79-
command: 'yarn install --pure-lockfile --no-progress'
80-
- run:
81-
name: Package
82-
command: './scripts/package_target.sh darwin-x64-unknown'
83-
- run:
84-
name: Archive
85-
command: './scripts/archive_target.sh darwin-x64-unknown'
86-
- persist_to_workspace:
87-
root: .
88-
paths:
89-
- dist/*
90-
- artifacts/*
91-
- store_artifacts:
92-
path: artifacts
93-
94-
package_windows_x64:
54+
package:
55+
description: "Package plugin"
56+
parameters:
57+
arch:
58+
type: string
59+
skip_chromium:
60+
type: boolean
61+
default: false
62+
override_output:
63+
type: string
64+
default: ''
9565
<<: *defaults
9666
steps:
9767
- checkout
@@ -105,36 +75,29 @@ jobs:
10575
command: 'yarn install --pure-lockfile --no-progress'
10676
- run:
10777
name: Package
108-
command: './scripts/package_target.sh win32-x64-unknown'
78+
command: |
79+
if [ << parameters.skip_chromium >> = true ]; then
80+
./scripts/package_target.sh << parameters.arch >> true << parameters.override_output >>
81+
else
82+
./scripts/package_target.sh << parameters.arch >>
83+
fi
84+
- install-grabpl
85+
- run:
86+
name: Create and sign plugin manifest
87+
command: |
88+
if [ << parameters.skip_chromium >> = true ]; then
89+
/tmp/grabpl build-plugin-manifest ./dist/<< parameters.override_output >>
90+
else
91+
/tmp/grabpl build-plugin-manifest ./dist/plugin-<< parameters.arch >>
92+
fi
10993
- run:
11094
name: Archive
111-
command: './scripts/archive_target.sh win32-x64-unknown'
112-
- persist_to_workspace:
113-
root: .
114-
paths:
115-
- dist/*
116-
- artifacts/*
117-
- store_artifacts:
118-
path: artifacts
119-
120-
package_linux_x64_no_chromium:
121-
<<: *defaults
122-
steps:
123-
- checkout
124-
- attach_workspace:
125-
at: .
126-
- restore_cache:
127-
keys:
128-
- dependency-cache-{{ checksum "yarn.lock" }}
129-
- run:
130-
name: Install dependencies
131-
command: 'yarn install --pure-lockfile --no-progress'
132-
- run:
133-
name: Package
134-
command: './scripts/package_target.sh linux-x64-glibc true plugin-linux-x64-glibc-no-chromium'
135-
- run:
136-
name: Archive
137-
command: './scripts/archive_target.sh linux-x64-glibc plugin-linux-x64-glibc-no-chromium'
95+
command: |
96+
if [ << parameters.skip_chromium >> = true ]; then
97+
./scripts/archive_target.sh << parameters.arch >> << parameters.override_output >>
98+
else
99+
./scripts/archive_target.sh << parameters.arch >>
100+
fi
138101
- persist_to_workspace:
139102
root: .
140103
paths:
@@ -183,30 +146,30 @@ workflows:
183146
jobs:
184147
- build:
185148
filters: *filter-only-master
186-
- package_linux_x64:
187-
requires:
188-
- build
189-
filters: *filter-only-master
190-
- package_darwin_x64:
191-
requires:
192-
- build
149+
- package:
193150
filters: *filter-only-master
194-
- package_windows_x64:
195151
requires:
196152
- build
153+
name: package-<< matrix.arch >>
154+
matrix:
155+
parameters:
156+
arch: [linux-x64-glibc, darwin-x64-unknown, win32-x64-unknown]
157+
- package:
197158
filters: *filter-only-master
198-
- package_linux_x64_no_chromium:
199159
requires:
200160
- build
201-
filters: *filter-only-master
161+
name: package-linux-x64-glibc-no-chromium
162+
arch: linux-x64-glibc
163+
skip_chromium: true
164+
override_output: plugin-linux-x64-glibc-no-chromium
202165
- approve-release:
203166
type: approval
204167
requires:
205168
- build
206-
- package_linux_x64
207-
- package_darwin_x64
208-
- package_windows_x64
209-
- package_linux_x64_no_chromium
169+
- package-linux-x64-glibc
170+
- package-darwin-x64-unknown
171+
- package-win32-x64-unknown
172+
- package-linux-x64-glibc-no-chromium
210173
filters: *filter-only-master
211174
- publish-github-release:
212175
requires:
@@ -220,4 +183,20 @@ workflows:
220183
build-branches-and-prs:
221184
jobs:
222185
- build:
223-
filters: *filter-not-release-or-master
186+
filters: *filter-not-release-or-master
187+
- package:
188+
filters: *filter-not-release-or-master
189+
requires:
190+
- build
191+
name: package-<< matrix.arch >>
192+
matrix:
193+
parameters:
194+
arch: [linux-x64-glibc, darwin-x64-unknown, win32-x64-unknown]
195+
- package:
196+
filters: *filter-not-release-or-master
197+
requires:
198+
- build
199+
name: package-linux-x64-glibc-no-chromium
200+
arch: linux-x64-glibc
201+
skip_chromium: true
202+
override_output: plugin-linux-x64-glibc-no-chromium

plugin.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"name": "Grafana Image Renderer",
44
"id": "grafana-image-renderer",
55

6+
"backend": true,
7+
68
"info": {
79
"description": "Grafana Backend Image Renderer that uses headless chrome to capture images.",
810
"author": {

0 commit comments

Comments
 (0)