-
Notifications
You must be signed in to change notification settings - Fork 157
/
Copy pathconfig.yml
280 lines (266 loc) · 7.96 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
version: 2.1
aliases:
- &filter-not-release-or-master
tags:
ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: master
- &filter-only-master
branches:
only: master
defaults: &defaults
working_directory: ~/grafana-image-renderer
docker:
- image: cimg/node:14.18.3
commands:
install-grabpl:
description: 'Install Grafana build pipeline tool'
steps:
- run:
name: 'Install Grafana build pipeline tool'
command: |
VERSION=2.1.1
curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v${VERSION}/grabpl
chmod +x grabpl
mv grabpl /tmp
jobs:
build:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: Yarn Install
command: 'yarn install --frozen-lockfile --no-progress'
- save_cache:
name: Save Yarn Package Cache
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: Build
command: 'yarn build'
- persist_to_workspace:
root: .
paths:
- build/*
package:
description: 'Package plugin'
parameters:
arch:
type: string
skip_chromium:
type: boolean
default: false
override_output:
type: string
default: ''
skip_signing_errors:
type: boolean
default: false
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: 'yarn install --pure-lockfile --no-progress'
- run:
name: Package
command: |
if [ << parameters.skip_chromium >> = true ]; then
./scripts/package_target.sh << parameters.arch >> true << parameters.override_output >>
else
./scripts/package_target.sh << parameters.arch >>
fi
- install-grabpl
- run:
name: Create and sign plugin manifest
command: |
set +e
if [ << parameters.skip_chromium >> = true ]; then
/tmp/grabpl build-plugin-manifest ./dist/<< parameters.override_output >>
else
/tmp/grabpl build-plugin-manifest ./dist/plugin-<< parameters.arch >>
fi
EXIT_CODE=$?
if [ << parameters.skip_signing_errors >> = true ]; then
exit 0
else
exit $EXIT_CODE
fi
- run:
name: Archive
command: |
if [ << parameters.skip_chromium >> = true ]; then
./scripts/archive_target.sh << parameters.arch >> << parameters.override_output >>
else
./scripts/archive_target.sh << parameters.arch >>
fi
- persist_to_workspace:
root: .
paths:
- dist/*
- artifacts/*
- store_artifacts:
path: artifacts
publish-github-release:
working_directory: ~/grafana-image-renderer
docker:
- image: cibuilds/github:0.12
steps:
- checkout
- add_ssh_keys:
fingerprints:
- '9a:40:f1:ad:ea:d5:c9:07:bd:54:dc:a8:0d:ea:be:0e'
- attach_workspace:
at: .
- run:
name: 'Install dependencies'
command: 'apk add --update --no-cache jq'
- run:
name: 'Generate MD5 checksums'
command: './scripts/generate_md5sum.sh'
- run:
name: 'Publish Release on GitHub'
command: './scripts/publish_github_release.sh'
publish-docker-release:
working_directory: ~/grafana-image-renderer
environment:
IMAGE_NAME: grafana/grafana-image-renderer
docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- setup_remote_docker:
version: 19.03.13
- run:
name: 'Build and push Docker image'
command: ./scripts/build_push_docker.sh
publish-docker-master:
working_directory: ~/grafana-image-renderer
environment:
IMAGE_NAME: grafana/grafana-image-renderer
docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- setup_remote_docker:
version: 19.03.13
- run:
name: 'Build and push Docker image'
command: ./scripts/build_push_docker.sh master
security_scan:
executor: scan_exec
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
name: restore node_modules
keys:
- build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
- run:
name: Run Veracode scan
command: |
apk add curl
# Increase heap size or the scanner will die.
export _JAVA_OPTIONS=-Xmx4g
mkdir -p ci/jobs/security_scan
curl -sSL https://download.sourceclear.com/ci.sh | sh | tee ci/jobs/security_scan/sourclear_scan.out
##
# Not failing builds now if we detect items we deem a problem in the scan output, but the following
# Would be an example
#
# grep "High Risk" ci/jobs/security_scan/sourclear_scan.out && false || true
- persist_to_workspace:
root: .
paths:
- ci/jobs/security_scan
- store_test_results:
path: ci/jobs/security_scan
- store_artifacts:
path: ci/jobs/security_scan
workflows:
version: 2
build-master:
jobs:
- build:
filters: *filter-only-master
- security_scan:
filters: *filter-only-master
requires:
- build
- package:
filters: *filter-only-master
requires:
- build
name: package-<< matrix.arch >>
matrix:
parameters:
arch: [linux-x64-glibc, darwin-x64-unknown, darwin-arm64-unknown, win32-x64-unknown]
- package:
filters: *filter-only-master
requires:
- build
name: package-linux-x64-glibc-no-chromium
arch: linux-x64-glibc
skip_chromium: true
override_output: plugin-linux-x64-glibc-no-chromium
- publish-docker-master:
requires:
- build
filters: *filter-only-master
- approve-release:
type: approval
requires:
- build
- package-linux-x64-glibc
- package-darwin-x64-unknown
- package-darwin-arm64-unknown
- package-win32-x64-unknown
- package-linux-x64-glibc-no-chromium
filters: *filter-only-master
- publish-github-release:
requires:
- approve-release
filters: *filter-only-master
- publish-docker-release:
requires:
- publish-github-release
filters: *filter-only-master
build-branches-and-prs:
jobs:
- build:
filters: *filter-not-release-or-master
- security_scan:
requires:
- build
- package:
filters: *filter-not-release-or-master
requires:
- build
name: package-<< matrix.arch >>
matrix:
parameters:
arch: [linux-x64-glibc, darwin-x64-unknown, darwin-arm64-unknown, win32-x64-unknown]
skip_signing_errors: [true]
- package:
filters: *filter-not-release-or-master
requires:
- build
name: package-linux-x64-glibc-no-chromium
arch: linux-x64-glibc
skip_chromium: true
override_output: plugin-linux-x64-glibc-no-chromium
skip_signing_errors: true
executors:
scan_exec:
docker:
- image: srclosson/grafana-plugin-ci-alpine:latest