Make sure you have the following dependencies installed first:
- Install dependencies
yarn install
- Build plugin in development mode or run in watch mode
yarn dev
or
yarn watch
- Build plugin in production mode
yarn build
- Run tests
yarn test
- Build backend for all platforms
mage buildAll
- Run tests
mage test
Instructions to install grafana server locally can be found, here:
To install the plugin locally, copy the built plugin to the Grafana plugin directory (usually: /var/lib/grafana/plugins
)
- Create AWS credentials file:
cat << EOF >> ~/.aws/credentials
[DEFAULT]
[default]
aws_access_key_id=<your aws access key id>
aws_secret_access_key=<your aws secret access key>
EOF
- Start Grafana docker
cd /Workspace/iot-sitewise-datasource
yarn server
OR
# Run from directory containing iot-sitewise-datasource clone
cd /Workspace/iot-sitewise-datasource
docker run -e GF_DEFAULT_APP_MODE=development -e AWS_SHARED_CREDENTIALS_FILE="/Users/grafana/.aws/credentials" -d -p 3000:3000 -v ~/.aws/:/Users/grafana/.aws/ -v "$(pwd)"/dist:/var/lib/grafana/plugins --name=grafana grafana/grafana:latest
- Reload plugin
docker restart grafana
Access from http://localhost:3000
.
First time login will be user:admin password:admin
You need to have commit rights to the GitHub repository to publish a release.
- Update the version number in the
package.json
file. - Update the
CHANGELOG.md
by copy and pasting the relevant PRs from Github's Release drafter interface or by runningyarn generate-release-notes
(you'll need to install the gh cli and jq to run this command). - PR the changes.
- Once merged, follow the Drone release process that you can find here
This plugin uses playwright and @grafana/plugin-e2e for e2e end tests.
To get the best fidelity, we make live requests to AWS for many of our e2e tests. In order to run them you will need to create an AWS User and secret/access keys and add them in either as env variables (AWS_ACCESS_KEY
and AWS_SECRET_KEY
) which is how we run our tests in CI or add a yaml file to the provisioning repo like so:
apiVersion: 1
deleteDatasources:
- name: sitewise
orgId: 1
datasources:
- name: sitewise
type: grafana-iot-sitewise-datasource
editable: true
jsonData:
authType: keys
defaultRegion: us-east-1
secureJsonData:
accessKey: {your access key here}
secretKey: {your secret key here}
To run e2e tests locally:
yarn run e2e
This will then print out a report that can be viewed. Or To run e2e tests locally with UI mode for easier debugging:
yarn run e2e:debug
You may also wish to enable "traces" in the playwright.config.ts file which will show screenshots of failures and network requests.