Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit 4a91ffc

Browse files
authored
Updates to release process (#55)
* update version and packages * update circleci * add version dependency
1 parent 6027c93 commit 4a91ffc

File tree

5 files changed

+483
-415
lines changed

5 files changed

+483
-415
lines changed

.circleci/config.yml

Lines changed: 165 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,97 +2,168 @@ version: 2
22

33
aliases:
44
# Workflow filters
5-
- &filter-only-release
6-
branches:
7-
ignore: /.*/
8-
tags:
9-
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
10-
- &filter-not-release-or-master
11-
tags:
12-
ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
13-
branches:
14-
ignore: master
155
- &filter-only-master
166
branches:
177
only: master
188

199
defaults: &defaults
2010
working_directory: ~/grafana-influxdb-flux-datasource
2111
docker:
22-
- image: circleci/node:10.15.3-stretch
12+
- image: circleci/node:10.16.3-stretch
2313

2414
jobs:
25-
build:
15+
build_plugin:
2616
<<: *defaults
2717
steps:
28-
- checkout
29-
- restore_cache:
30-
keys:
31-
- yarn-packages-{{ checksum "yarn.lock" }}
32-
- run:
33-
name: Build
34-
command: |
35-
DATASOURCE_NAME=grafana-influxdb-flux-datasource
36-
yarn install --pure-lockfile --no-progress
37-
yarn build
38-
sudo apt-get install jq
39-
VERSION=`cat dist/plugin.json|jq '.info.version'| sed s/\"//g`
40-
# create zip file
41-
cd ~
42-
echo "Creating ZIP"
43-
zip \
44-
-x ${DATASOURCE_NAME}/.git/**\* \
45-
-x ${DATASOURCE_NAME}/node_modules/**\* \
46-
-r /tmp/${DATASOURCE_NAME}-${VERSION}.zip \
47-
${DATASOURCE_NAME}
48-
# create tar file
49-
echo "Creating TAR"
50-
tar \
51-
--exclude .git \
52-
--exclude ${DATASOURCE_NAME}/node_modules \
53-
-cvf /tmp/${DATASOURCE_NAME}-${VERSION}.tar \
54-
${DATASOURCE_NAME}
55-
gzip /tmp/${DATASOURCE_NAME}-${VERSION}.tar
56-
# create artifacts
57-
mkdir -p ~/${DATASOURCE_NAME}/artifacts
58-
mv /tmp/${DATASOURCE_NAME}-${VERSION}.zip ~/${DATASOURCE_NAME}/artifacts/
59-
mv /tmp/${DATASOURCE_NAME}-${VERSION}.tar.gz ~/${DATASOURCE_NAME}/artifacts/
60-
no_output_timeout: 5m
61-
- save_cache:
62-
name: Save Yarn Package Cache
63-
key: yarn-packages-{{ checksum "yarn.lock" }}
64-
paths:
65-
- ~/.cache/yarn
66-
- persist_to_workspace:
67-
root: .
68-
paths:
69-
- artifacts
70-
- dist
71-
- store_artifacts:
72-
path: artifacts
73-
- store_artifacts:
74-
path: dist
18+
- checkout
19+
- restore_cache:
20+
keys:
21+
- yarn-packages-{{ checksum "yarn.lock" }}
22+
- run:
23+
name: Install yarn
24+
command: |
25+
sudo npm install -g yarn --quiet
26+
yarn install --pure-lockfile
27+
- run:
28+
name: Run Toolkit Build
29+
command: npx grafana-toolkit plugin:ci-build
30+
- save_cache:
31+
paths:
32+
- node_modules
33+
key: yarn-packages-{{ checksum "yarn.lock" }}
34+
- persist_to_workspace:
35+
root: .
36+
paths:
37+
- ci
7538

76-
test:
39+
build_docs:
7740
<<: *defaults
7841
steps:
79-
- checkout
80-
- restore_cache:
81-
keys:
82-
- yarn-packages-{{ checksum "yarn.lock" }}
83-
- run:
84-
name: Test
85-
command: |
86-
yarn install --pure-lockfile --no-progress
87-
sudo npm install -g jest
88-
yarn test specs
89-
- store_artifacts:
90-
path: coverage
42+
- checkout
43+
- restore_cache:
44+
keys:
45+
- yarn-packages-{{ checksum "yarn.lock" }}
46+
- run:
47+
name: Install yarn
48+
command: |
49+
sudo npm install -g yarn --quiet
50+
yarn install --pure-lockfile
51+
mkdir ci # Avoid error if not exists
52+
- run:
53+
name: Build Docs
54+
command: npx grafana-toolkit plugin:ci-docs
55+
- save_cache:
56+
paths:
57+
- node_modules
58+
key: yarn-packages-{{ checksum "yarn.lock" }}
59+
- persist_to_workspace:
60+
root: .
61+
paths:
62+
- ci
63+
64+
package:
65+
<<: *defaults
66+
steps:
67+
- checkout
68+
- attach_workspace:
69+
at: .
70+
- restore_cache:
71+
keys:
72+
- yarn-packages-{{ checksum "yarn.lock" }}
73+
- run:
74+
name: Package Distribution
75+
command: |
76+
ls -l ci
77+
ls -l ci/jobs
78+
ls -l ci/jobs/build_plugin
79+
ls -l ci/jobs/build_plugin/dist
80+
npx grafana-toolkit plugin:ci-package
81+
echo Build TAR
82+
DATASOURCE_NAME=grafana-influxdb-flux-datasource
83+
mkdir -p ci/jobs/build_tar/${DATASOURCE_NAME}
84+
cp -rp ci/jobs/build_plugin/dist/* ci/jobs/build_tar/${DATASOURCE_NAME}
85+
ls -al ci/jobs/build_tar
86+
ls -al ci/jobs/build_tar/${DATASOURCE_NAME}
87+
cd ci/jobs/build_tar
88+
ls -al
89+
sudo apt-get install jq
90+
VERSION=`cat ${DATASOURCE_NAME}/plugin.json|jq '.info.version'| sed s/\"//g` # create tar file
91+
echo "Creating TAR"
92+
tar \
93+
-cvf /tmp/${DATASOURCE_NAME}-${VERSION}.tar \
94+
${DATASOURCE_NAME}
95+
gzip /tmp/${DATASOURCE_NAME}-${VERSION}.tar
96+
mv /tmp/${DATASOURCE_NAME}-${VERSION}.tar.gz ~/${DATASOURCE_NAME}/ci/packages/
97+
shasum \
98+
~/${DATASOURCE_NAME}/ci/packages/${DATASOURCE_NAME}-${VERSION}.tar.gz > \
99+
~/${DATASOURCE_NAME}/ci/packages/${DATASOURCE_NAME}-${VERSION}.tar.gz.sha1
100+
- persist_to_workspace:
101+
root: .
102+
paths:
103+
- ci
104+
- store_artifacts:
105+
path: ci/packages
106+
107+
report:
108+
<<: *defaults
109+
steps:
110+
- checkout
111+
- attach_workspace:
112+
at: .
113+
- restore_cache:
114+
keys:
115+
- yarn-packages-{{ checksum "yarn.lock" }}
116+
- run:
117+
name: Toolkit Report
118+
command: |
119+
# skipped - S3 permission issue
120+
# npx grafana-toolkit plugin:ci-report
121+
- store_artifacts:
122+
path: ci
123+
124+
test_integration:
125+
<<: *defaults
126+
docker:
127+
- image: circleci/node:10-browsers
128+
steps:
129+
- checkout
130+
- attach_workspace:
131+
at: .
132+
- restore_cache:
133+
keys:
134+
- yarn-packages-{{ checksum "yarn.lock" }}
135+
- run:
136+
name: Setup Grafana (local install)
137+
command: |
138+
wget https://dl.grafana.com/oss/release/grafana_6.4.2_amd64.deb
139+
sudo apt-get install -y adduser libfontconfig1
140+
sudo dpkg -i grafana_6.4.2_amd64.deb
141+
sudo apt-get install locate
142+
sudo updatedb
143+
sudo locate grafana
144+
sudo cat /etc/grafana/grafana.ini
145+
sudo echo ------------------------
146+
sudo cp ci/grafana-test-env/custom.ini /usr/share/grafana/conf/custom.ini
147+
sudo cp ci/grafana-test-env/custom.ini /etc/grafana/grafana.ini
148+
sudo service grafana-server start
149+
sudo grafana-cli --version
150+
- run:
151+
name: Run e2e tests
152+
command: |
153+
npx grafana-toolkit plugin:ci-test
154+
- persist_to_workspace:
155+
root: .
156+
paths:
157+
- ci/jobs/test_integration
158+
- store_test_results:
159+
path: ci/jobs/test_integration
160+
- store_artifacts:
161+
path: ci/jobs/test_integration
91162

92163
publish-github-release:
93164
working_directory: ~/grafana-influxdb-flux-datasource
94165
docker:
95-
- image: cibuilds/github:0.12
166+
- image: cibuilds/github:0.13
96167
steps:
97168
- checkout
98169
- add_ssh_keys:
@@ -104,9 +175,15 @@ jobs:
104175
name: "Publish Release on GitHub"
105176
command: |
106177
DATASOURCE_NAME=grafana-influxdb-flux-datasource
178+
# copy ci dist
179+
cp -r ci/jobs/build_plugin/dist .
180+
# copy ci artifacts
181+
mkdir -p artifacts
182+
cp -r ci/packages/* artifacts
183+
#
107184
apk add --update --no-cache jq
108185
RELEASE_NOTES=`awk 'BEGIN {FS="##"; RS=""} FNR==3 {print; exit}' CHANGELOG.md`
109-
VERSION=`cat src/plugin.json|jq '.info.version'| sed s/\"//g`
186+
VERSION=`cat dist/plugin.json|jq '.info.version'| sed s/\"//g`
110187
ls -al
111188
ls -al ./artifacts
112189
git config user.email "[email protected]"
@@ -131,30 +208,27 @@ jobs:
131208
132209
workflows:
133210
version: 2
134-
build-master:
211+
plugin_workflow:
135212
jobs:
136-
- build:
137-
filters: *filter-only-master
138-
- test:
213+
- build_plugin
214+
- build_docs:
139215
requires:
140-
- build
141-
filters: *filter-only-master
216+
- build_plugin
217+
- package:
218+
requires:
219+
- build_docs
220+
- test_integration:
221+
requires:
222+
- package
223+
- report:
224+
requires:
225+
- test_integration
142226
- approve-release:
143227
type: approval
144228
requires:
145-
- build
146-
- test
229+
- report
147230
filters: *filter-only-master
148231
- publish-github-release:
149232
requires:
150233
- approve-release
151234
filters: *filter-only-master
152-
153-
build-branches-and-prs:
154-
jobs:
155-
- build:
156-
filters: *filter-not-release-or-master
157-
- test:
158-
requires:
159-
- build
160-
filters: *filter-not-release-or-master

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Change Log
2+
23
## [5.4.0] - 2019-10-09
34

45
- Slate fixes for Grafana 6.4.x
56
- Fix for queries which group by time, and return _start and _stop rather than _time
67

8+
NOTE: This version is only compatible with Grafana v6.4+
9+
710
## [5.3.2] - 2019-07-07
811

912
- Fix for range error when expanding suggestion [#39](https://github.com/grafana/influxdb-flux-datasource/pull/39)

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "grafana-influxdb-flux-datasource",
3-
"version": "5.3.2",
3+
"version": "5.4.0",
44
"description": "Grafana data source for InfluxDB (Flux query support)",
55
"private": true,
66
"scripts": {
@@ -14,12 +14,12 @@
1414
"dependencies": {
1515
"diff": "^4.0.1",
1616
"immutable": "3.8.2",
17-
"lodash": "4.17.11",
17+
"lodash": "4.17.15",
1818
"moment": "2.24.0",
19-
"papaparse": "4.6.3",
20-
"prismjs": "1.16.0",
19+
"papaparse": "5.1.0",
20+
"prismjs": "1.17.1",
2121
"ts-loader": "^6.2.0",
22-
"typescript": "^3.6.3",
22+
"typescript": "^3.6.4",
2323
"shelljs": "^0.8.3"
2424
},
2525
"devDependencies": {

src/plugin.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@
2929
"url": "{{.JsonData.url}}",
3030
"headers": [{"name": "Authorization", "content": "Token {{.SecureJsonData.token}}"}]
3131
}
32-
]
32+
],
33+
"dependencies": {
34+
"grafanaVersion": "6.4.x"
35+
}
3336
}

0 commit comments

Comments
 (0)