Skip to content

Latest commit

 

History

History
95 lines (64 loc) · 3.71 KB

CONTRIBUTING.md

File metadata and controls

95 lines (64 loc) · 3.71 KB

Building and releasing

How to build the Athena data source plugin locally

git config --global url."ssh://[email protected]:cloudwicklabs/".insteadOf "https://github.com/cloudwicklabs/"
npm run dev && mage -v && \
 npx @grafana/sign-plugin@latest --rootUrls https://example.com/amorphic,http://127.0.0.1:3000 && \
 docker-compose up --build

Dependencies

Make sure you have the following dependencies installed first:

Frontend

  1. Install dependencies

    yarn install --pure-lockfile
  2. Build plugin in development mode or run in watch mode

    yarn dev

    or

    yarn watch
  3. Build plugin in production mode

    yarn build

Backend

  1. Build the backend binaries

    mage -v

Setting up a go workspace

Setting up go workspace can be helpful when making changes across modules like grafana-aws-sdk and sqlds and wanting to see those changes reflected in the Athena data source.

From https://go.dev/blog/get-familiar-with-workspaces:

Workspaces in Go 1.18 let you work on multiple modules simultaneously without having to edit go.mod files for each module. Each module within a workspace is treated as a main module when resolving dependencies.

Previously, to add a feature to one module and use it in another module, you needed to either publish the changes to the first module, or edit the go.mod file of the dependent module with a replace directive for your local, unpublished module changes. In order to publish without errors, you had to remove the replace directive from the dependent module’s go.mod file after you published the local changes to the first module.

  1. Make a new directory somewhere, for example athena_workspace
  2. cd athena_workspace
  3. git clone https://github.com/grafana/athena-datasource.git
  4. git clone https://github.com/grafana/grafana-aws-sdk
  5. git clone https://github.com/grafana/sqlds
  6. go work init ./athena-datasource ./grafana-aws-sdk ./sqlds
  7. Make modifications in any of these directories and build the backend in athena-datasource with mage as usual. The changes in these directories will be taken into account.

If you build Grafana locally, you can for example symlink athena-datasource to your clone of github.com/grafana/grafana's data/plugins directory, e.g. cd <path to your Grafana repo>/github.com/grafana/grafana/data/plugins && ln -s <path to your workspaces>/athena_workspace/athena-datasource athena-datasource

Build a release for the Athena data source plugin

Pre-requisites

Before doing a release, make sure that the GitHub repository is configured with a GRAFANA_API_KEY to be able to sign the plugin and that the Golang and Node versions in the release.yaml workflow are correct.

Also, make sure that the path to the plugin validator in the release.yaml is correct (this fixes the error pushd: ./plugin-validator/cmd/plugincheck: No such file or directory):

pushd ./plugin-validator/pkg/cmd/plugincheck`

Release

You need to have commit rights to the GitHub repository to publish a release.

  1. Update the version number in the package.json file.
  2. Update the CHANGELOG.md with the changes contained in the release.
  3. Commit the changes to master and push to GitHub.
  4. Follow the Drone release process that you can find here