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

Commit

Permalink
Updates to release process (#55)
Browse files Browse the repository at this point in the history
* update version and packages
* update circleci
* add version dependency
  • Loading branch information
briangann authored Oct 11, 2019
1 parent 6027c93 commit 4a91ffc
Show file tree
Hide file tree
Showing 5 changed files with 483 additions and 415 deletions.
256 changes: 165 additions & 91 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,168 @@ version: 2

aliases:
# Workflow filters
- &filter-only-release
branches:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
- &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-influxdb-flux-datasource
docker:
- image: circleci/node:10.15.3-stretch
- image: circleci/node:10.16.3-stretch

jobs:
build:
build_plugin:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Build
command: |
DATASOURCE_NAME=grafana-influxdb-flux-datasource
yarn install --pure-lockfile --no-progress
yarn build
sudo apt-get install jq
VERSION=`cat dist/plugin.json|jq '.info.version'| sed s/\"//g`
# create zip file
cd ~
echo "Creating ZIP"
zip \
-x ${DATASOURCE_NAME}/.git/**\* \
-x ${DATASOURCE_NAME}/node_modules/**\* \
-r /tmp/${DATASOURCE_NAME}-${VERSION}.zip \
${DATASOURCE_NAME}
# create tar file
echo "Creating TAR"
tar \
--exclude .git \
--exclude ${DATASOURCE_NAME}/node_modules \
-cvf /tmp/${DATASOURCE_NAME}-${VERSION}.tar \
${DATASOURCE_NAME}
gzip /tmp/${DATASOURCE_NAME}-${VERSION}.tar
# create artifacts
mkdir -p ~/${DATASOURCE_NAME}/artifacts
mv /tmp/${DATASOURCE_NAME}-${VERSION}.zip ~/${DATASOURCE_NAME}/artifacts/
mv /tmp/${DATASOURCE_NAME}-${VERSION}.tar.gz ~/${DATASOURCE_NAME}/artifacts/
no_output_timeout: 5m
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- persist_to_workspace:
root: .
paths:
- artifacts
- dist
- store_artifacts:
path: artifacts
- store_artifacts:
path: dist
- checkout
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install yarn
command: |
sudo npm install -g yarn --quiet
yarn install --pure-lockfile
- run:
name: Run Toolkit Build
command: npx grafana-toolkit plugin:ci-build
- save_cache:
paths:
- node_modules
key: yarn-packages-{{ checksum "yarn.lock" }}
- persist_to_workspace:
root: .
paths:
- ci

test:
build_docs:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Test
command: |
yarn install --pure-lockfile --no-progress
sudo npm install -g jest
yarn test specs
- store_artifacts:
path: coverage
- checkout
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install yarn
command: |
sudo npm install -g yarn --quiet
yarn install --pure-lockfile
mkdir ci # Avoid error if not exists
- run:
name: Build Docs
command: npx grafana-toolkit plugin:ci-docs
- save_cache:
paths:
- node_modules
key: yarn-packages-{{ checksum "yarn.lock" }}
- persist_to_workspace:
root: .
paths:
- ci

package:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Package Distribution
command: |
ls -l ci
ls -l ci/jobs
ls -l ci/jobs/build_plugin
ls -l ci/jobs/build_plugin/dist
npx grafana-toolkit plugin:ci-package
echo Build TAR
DATASOURCE_NAME=grafana-influxdb-flux-datasource
mkdir -p ci/jobs/build_tar/${DATASOURCE_NAME}
cp -rp ci/jobs/build_plugin/dist/* ci/jobs/build_tar/${DATASOURCE_NAME}
ls -al ci/jobs/build_tar
ls -al ci/jobs/build_tar/${DATASOURCE_NAME}
cd ci/jobs/build_tar
ls -al
sudo apt-get install jq
VERSION=`cat ${DATASOURCE_NAME}/plugin.json|jq '.info.version'| sed s/\"//g` # create tar file
echo "Creating TAR"
tar \
-cvf /tmp/${DATASOURCE_NAME}-${VERSION}.tar \
${DATASOURCE_NAME}
gzip /tmp/${DATASOURCE_NAME}-${VERSION}.tar
mv /tmp/${DATASOURCE_NAME}-${VERSION}.tar.gz ~/${DATASOURCE_NAME}/ci/packages/
shasum \
~/${DATASOURCE_NAME}/ci/packages/${DATASOURCE_NAME}-${VERSION}.tar.gz > \
~/${DATASOURCE_NAME}/ci/packages/${DATASOURCE_NAME}-${VERSION}.tar.gz.sha1
- persist_to_workspace:
root: .
paths:
- ci
- store_artifacts:
path: ci/packages

report:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Toolkit Report
command: |
# skipped - S3 permission issue
# npx grafana-toolkit plugin:ci-report
- store_artifacts:
path: ci

test_integration:
<<: *defaults
docker:
- image: circleci/node:10-browsers
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Setup Grafana (local install)
command: |
wget https://dl.grafana.com/oss/release/grafana_6.4.2_amd64.deb
sudo apt-get install -y adduser libfontconfig1
sudo dpkg -i grafana_6.4.2_amd64.deb
sudo apt-get install locate
sudo updatedb
sudo locate grafana
sudo cat /etc/grafana/grafana.ini
sudo echo ------------------------
sudo cp ci/grafana-test-env/custom.ini /usr/share/grafana/conf/custom.ini
sudo cp ci/grafana-test-env/custom.ini /etc/grafana/grafana.ini
sudo service grafana-server start
sudo grafana-cli --version
- run:
name: Run e2e tests
command: |
npx grafana-toolkit plugin:ci-test
- persist_to_workspace:
root: .
paths:
- ci/jobs/test_integration
- store_test_results:
path: ci/jobs/test_integration
- store_artifacts:
path: ci/jobs/test_integration

publish-github-release:
working_directory: ~/grafana-influxdb-flux-datasource
docker:
- image: cibuilds/github:0.12
- image: cibuilds/github:0.13
steps:
- checkout
- add_ssh_keys:
Expand All @@ -104,9 +175,15 @@ jobs:
name: "Publish Release on GitHub"
command: |
DATASOURCE_NAME=grafana-influxdb-flux-datasource
# copy ci dist
cp -r ci/jobs/build_plugin/dist .
# copy ci artifacts
mkdir -p artifacts
cp -r ci/packages/* artifacts
#
apk add --update --no-cache jq
RELEASE_NOTES=`awk 'BEGIN {FS="##"; RS=""} FNR==3 {print; exit}' CHANGELOG.md`
VERSION=`cat src/plugin.json|jq '.info.version'| sed s/\"//g`
VERSION=`cat dist/plugin.json|jq '.info.version'| sed s/\"//g`
ls -al
ls -al ./artifacts
git config user.email "[email protected]"
Expand All @@ -131,30 +208,27 @@ jobs:
workflows:
version: 2
build-master:
plugin_workflow:
jobs:
- build:
filters: *filter-only-master
- test:
- build_plugin
- build_docs:
requires:
- build
filters: *filter-only-master
- build_plugin
- package:
requires:
- build_docs
- test_integration:
requires:
- package
- report:
requires:
- test_integration
- approve-release:
type: approval
requires:
- build
- test
- report
filters: *filter-only-master
- publish-github-release:
requires:
- approve-release
filters: *filter-only-master

build-branches-and-prs:
jobs:
- build:
filters: *filter-not-release-or-master
- test:
requires:
- build
filters: *filter-not-release-or-master
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Change Log

## [5.4.0] - 2019-10-09

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

NOTE: This version is only compatible with Grafana v6.4+

## [5.3.2] - 2019-07-07

- Fix for range error when expanding suggestion [#39](https://github.com/grafana/influxdb-flux-datasource/pull/39)
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grafana-influxdb-flux-datasource",
"version": "5.3.2",
"version": "5.4.0",
"description": "Grafana data source for InfluxDB (Flux query support)",
"private": true,
"scripts": {
Expand All @@ -14,12 +14,12 @@
"dependencies": {
"diff": "^4.0.1",
"immutable": "3.8.2",
"lodash": "4.17.11",
"lodash": "4.17.15",
"moment": "2.24.0",
"papaparse": "4.6.3",
"prismjs": "1.16.0",
"papaparse": "5.1.0",
"prismjs": "1.17.1",
"ts-loader": "^6.2.0",
"typescript": "^3.6.3",
"typescript": "^3.6.4",
"shelljs": "^0.8.3"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
"url": "{{.JsonData.url}}",
"headers": [{"name": "Authorization", "content": "Token {{.SecureJsonData.token}}"}]
}
]
],
"dependencies": {
"grafanaVersion": "6.4.x"
}
}
Loading

0 comments on commit 4a91ffc

Please sign in to comment.