2019-09-25 00:28:44 -05:00
# Guide to upgrading dependencies
2018-10-17 09:39:03 -05:00
Upgrading Go or Node.js requires making changes in many different files. See below for a list and explanation for each.
## Go
- CircleCi
2019-04-12 04:17:31 -05:00
- `grafana/build-container`
2018-10-17 09:39:03 -05:00
- Appveyor
- Dockerfile
## Node.js
- CircleCI
2019-04-12 04:17:31 -05:00
- `grafana/build-container`
2018-10-17 09:39:03 -05:00
- Appveyor
- Dockerfile
2019-09-25 00:28:44 -05:00
## Go dependencies
2018-10-17 09:39:03 -05:00
2019-04-30 05:01:43 -05:00
The Grafana project uses [Go modules ](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more ) to manage dependencies on external packages. This requires a working Go environment with version 1.11 or greater installed.
2018-10-17 09:39:03 -05:00
2020-09-30 14:45:07 -05:00
> **Note:** Since most developers of Grafana still use the `GOPATH` we need to specify `GO111MODULE=on` to make `go mod` and `got get` work as intended. If you have setup Grafana outside of the `GOPATH` on your machine you can skip `GO111MODULE=on` when running the commands below.
2019-07-02 02:43:25 -05:00
2019-04-30 05:01:43 -05:00
To add or update a new dependency, use the `go get` command:
```bash
2019-07-02 02:43:25 -05:00
# The GO111MODULE variable can be omitted when the code isn't located in GOPATH.
2019-04-30 05:01:43 -05:00
# Pick the latest tagged release.
2019-07-02 02:43:25 -05:00
GO111MODULE=on go get example.com/some/module/pkg
2019-04-30 05:01:43 -05:00
# Pick a specific version.
2019-07-02 02:43:25 -05:00
GO111MODULE=on go get example.com/some/module/pkg@vX.Y.Z
2019-04-30 05:01:43 -05:00
```
2020-04-23 12:23:51 -05:00
Tidy up the `go.mod` and `go.sum` files:
2018-10-17 09:39:03 -05:00
2019-07-02 02:43:25 -05:00
```bash
# The GO111MODULE variable can be omitted when the code isn't located in GOPATH.
GO111MODULE=on go mod tidy
```
2020-04-23 12:23:51 -05:00
You have to commit the changes to `go.mod` and `go.sum` before submitting the pull request.
2019-07-02 02:43:25 -05:00
2019-09-25 00:28:44 -05:00
## Node.js dependencies
2018-10-17 09:39:03 -05:00
Updated using `yarn` .
- `package.json`
## Where to make changes
### CircleCI
Our builds run on CircleCI through our build script.
#### Files
- `.circleci/config.yml` .
#### Dependencies
- nodejs
- golang
- grafana/build-container (our custom docker build container)
### grafana/build-container
2018-11-28 15:04:14 -06:00
The main build step (in CircleCI) is built using a custom build container that comes pre-baked with some of the necessary dependencies.
2018-10-17 09:39:03 -05:00
2019-07-02 02:43:25 -05:00
Link: [grafana/build-container ](https://github.com/grafana/grafana/tree/master/scripts/build/ci-build )
2018-10-17 09:39:03 -05:00
#### Dependencies
- fpm
- nodejs
- golang
- crosscompiling (several compilers)
### Appveyor
Master and release builds trigger test runs on Appveyors build environment so that tests will run on Windows.
#### Files:
- `appveyor.yml`
#### Dependencies
- nodejs
- golang
### Dockerfile
There is a Docker build for Grafana in the root of the project that allows anyone to build Grafana just using Docker.
#### Files
- `Dockerfile`
#### Dependencies
- nodejs
- golang
### Local developer environments
2018-11-28 15:04:14 -06:00
Please send out a notice in the grafana-dev slack channel when updating Go or Node.js to make it easier for everyone to update their local developer environments.