Skip to content

Commit 5b3b029

Browse files
committed
Merge branch 'master' into postgres-query-builder
2 parents 15c8ef6 + d0d6f44 commit 5b3b029

File tree

143 files changed

+346
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+346
-623
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ jobs:
147147
- run:
148148
name: sign packages
149149
command: './scripts/build/sign_packages.sh'
150+
- run:
151+
name: verify signed packages
152+
command: |
153+
mkdir -p ~/.rpmdb/pubkeys
154+
curl -s https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana > ~/.rpmdb/pubkeys/grafana.key
155+
./scripts/build/verify_signed_packages.sh dist/*.rpm
150156
- run:
151157
name: sha-sum packages
152158
command: 'go run build.go sha-dist'

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ Follow the setup guide in README.md
22

33
### Rebuild frontend assets on source change
44
```
5-
grunt && grunt watch
5+
yarn watch
66
```
77

88
### Rerun tests on source change
99
```
10-
grunt karma:dev
10+
yarn jest
1111
```
1212

1313
### Run tests for backend assets before commit
@@ -17,6 +17,6 @@ test -z "$(gofmt -s -l . | grep -v -E 'vendor/(github.com|golang.org|gopkg.in)'
1717

1818
### Run tests for frontend assets before commit
1919
```
20-
npm test
20+
yarn test
2121
go test -v ./pkg/...
2222
```

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ These are new features that's still being worked on and are in an experimental p
6161

6262
* **Dashboard**: Auto fit dashboard panels to optimize space used for current TV / Monitor [#12768](https://github.com/grafana/grafana/issues/12768)
6363

64+
### Tech
65+
66+
* **Frontend**: Convert all Frontend Karma tests to Jest tests [#12224](https://github.com/grafana/grafana/issues/12224)
67+
6468
# 5.2.2 (2018-07-25)
6569

6670
### Minor

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ To build the assets, rebuild on file change, and serve them by Grafana's webserv
4343
```bash
4444
npm install -g yarn
4545
yarn install --pure-lockfile
46-
yarn run watch
46+
yarn watch
4747
```
4848

4949
Build the assets, rebuild on file change with Hot Module Replacement (HMR), and serve them by webpack-dev-server (http://localhost:3333):
@@ -56,12 +56,7 @@ Note: HMR for Angular is not supported. If you edit files in the Angular part of
5656

5757
Run tests
5858
```bash
59-
yarn run jest
60-
```
61-
62-
Run karma tests
63-
```bash
64-
yarn run karma
59+
yarn jest
6560
```
6661

6762
### Recompile backend on source change
@@ -98,17 +93,13 @@ In your custom.ini uncomment (remove the leading `;`) sign. And set `app_mode =
9893
#### Frontend
9994
Execute all frontend tests
10095
```bash
101-
yarn run test
96+
yarn test
10297
```
10398

104-
Writing & watching frontend tests (we have two test runners)
99+
Writing & watching frontend tests
105100

106-
- jest for all new tests that do not require browser context (React+more)
107-
- Start watcher: `yarn run jest`
108-
- Jest will run all test files that end with the name ".jest.ts"
109-
- karma + mocha is used for testing angularjs components. We do want to migrate these test to jest over time (if possible).
110-
- Start watcher: `yarn run karma`
111-
- Karma+Mocha runs all files that end with the name "_specs.ts".
101+
- Start watcher: `yarn jest`
102+
- Jest will run all test files that end with the name ".test.ts"
112103

113104
#### Backend
114105
```bash

conf/defaults.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,18 @@ api_url = https://api.github.com/user
270270
team_ids =
271271
allowed_organizations =
272272

273+
#################################### GitLab Auth #########################
274+
[auth.gitlab]
275+
enabled = false
276+
allow_sign_up = true
277+
client_id = some_id
278+
client_secret = some_secret
279+
scopes = api
280+
auth_url = https://gitlab.com/oauth/authorize
281+
token_url = https://gitlab.com/oauth/token
282+
api_url = https://gitlab.com/api/v4
283+
allowed_groups =
284+
273285
#################################### Google Auth #########################
274286
[auth.google]
275287
enabled = false

docs/sources/installation/configuration.md

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ command line in the init.d script or the systemd service file.
8484

8585
### temp_data_lifetime
8686

87-
How long temporary images in `data` directory should be kept. Defaults to: `24h`. Supported modifiers: `h` (hours),
87+
How long temporary images in `data` directory should be kept. Defaults to: `24h`. Supported modifiers: `h` (hours),
8888
`m` (minutes), for example: `168h`, `30m`, `10h30m`. Use `0` to never clean up temporary files.
8989

9090
### logs
@@ -430,6 +430,108 @@ allowed_organizations = github google
430430

431431
<hr>
432432

433+
## [auth.gitlab]
434+
435+
> Only available in Grafana v5.3+.
436+
437+
You need to [create a GitLab OAuth
438+
application](https://docs.gitlab.com/ce/integration/oauth_provider.html).
439+
Choose a descriptive *Name*, and use the following *Redirect URI*:
440+
441+
```
442+
https://grafana.example.com/login/gitlab
443+
```
444+
445+
where `https://grafana.example.com` is the URL you use to connect to Grafana.
446+
Adjust it as needed if you don't use HTTPS or if you use a different port; for
447+
instance, if you access Grafana at `http://203.0.113.31:3000`, you should use
448+
449+
```
450+
http://203.0.113.31:3000/login/gitlab
451+
```
452+
453+
Finally, select *api* as the *Scope* and submit the form. Note that if you're
454+
not going to use GitLab groups for authorization (i.e. not setting
455+
`allowed_groups`, see below), you can select *read_user* instead of *api* as
456+
the *Scope*, thus giving a more restricted access to your GitLab API.
457+
458+
You'll get an *Application Id* and a *Secret* in return; we'll call them
459+
`GITLAB_APPLICATION_ID` and `GITLAB_SECRET` respectively for the rest of this
460+
section.
461+
462+
Add the following to your Grafana configuration file to enable GitLab
463+
authentication:
464+
465+
```ini
466+
[auth.gitlab]
467+
enabled = false
468+
allow_sign_up = false
469+
client_id = GITLAB_APPLICATION_ID
470+
client_secret = GITLAB_SECRET
471+
scopes = api
472+
auth_url = https://gitlab.com/oauth/authorize
473+
token_url = https://gitlab.com/oauth/token
474+
api_url = https://gitlab.com/api/v4
475+
allowed_groups =
476+
```
477+
478+
Restart the Grafana backend for your changes to take effect.
479+
480+
If you use your own instance of GitLab instead of `gitlab.com`, adjust
481+
`auth_url`, `token_url` and `api_url` accordingly by replacing the `gitlab.com`
482+
hostname with your own.
483+
484+
With `allow_sign_up` set to `false`, only existing users will be able to login
485+
using their GitLab account, but with `allow_sign_up` set to `true`, *any* user
486+
who can authenticate on GitLab will be able to login on your Grafana instance;
487+
if you use the public `gitlab.com`, it means anyone in the world would be able
488+
to login on your Grafana instance.
489+
490+
You can can however limit access to only members of a given group or list of
491+
groups by setting the `allowed_groups` option.
492+
493+
### allowed_groups
494+
495+
To limit access to authenticated users that are members of one or more [GitLab
496+
groups](https://docs.gitlab.com/ce/user/group/index.html), set `allowed_groups`
497+
to a comma- or space-separated list of groups. For instance, if you want to
498+
only give access to members of the `example` group, set
499+
500+
501+
```ini
502+
allowed_groups = example
503+
```
504+
505+
If you want to also give access to members of the subgroup `bar`, which is in
506+
the group `foo`, set
507+
508+
```ini
509+
allowed_groups = example, foo/bar
510+
```
511+
512+
Note that in GitLab, the group or subgroup name doesn't always match its
513+
display name, especially if the display name contains spaces or special
514+
characters. Make sure you always use the group or subgroup name as it appears
515+
in the URL of the group or subgroup.
516+
517+
Here's a complete example with `alloed_sign_up` enabled, and access limited to
518+
the `example` and `foo/bar` groups:
519+
520+
```ini
521+
[auth.gitlab]
522+
enabled = false
523+
allow_sign_up = true
524+
client_id = GITLAB_APPLICATION_ID
525+
client_secret = GITLAB_SECRET
526+
scopes = api
527+
auth_url = https://gitlab.com/oauth/authorize
528+
token_url = https://gitlab.com/oauth/token
529+
api_url = https://gitlab.com/api/v4
530+
allowed_groups = example, foo/bar
531+
```
532+
533+
<hr>
534+
433535
## [auth.google]
434536

435537
First, you need to create a Google OAuth Client:

docs/sources/project/building_from_source.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ For this you need nodejs (v.6+).
5757
```bash
5858
npm install -g yarn
5959
yarn install --pure-lockfile
60-
npm run watch
60+
yarn watch
6161
```
6262

6363
## Running Grafana Locally
@@ -83,21 +83,18 @@ go get github.com/Unknwon/bra
8383
bra run
8484
```
8585

86-
You'll also need to run `npm run watch` to watch for changes to the front-end (typescript, html, sass)
86+
You'll also need to run `yarn watch` to watch for changes to the front-end (typescript, html, sass)
8787

8888
### Running tests
8989

90-
- You can run backend Golang tests using "go test ./pkg/...".
91-
- Execute all frontend tests with "npm run test"
90+
- You can run backend Golang tests using `go test ./pkg/...`.
91+
- Execute all frontend tests with `yarn test`
9292

93-
Writing & watching frontend tests (we have two test runners)
93+
Writing & watching frontend tests
94+
95+
- Start watcher: `yarn jest`
96+
- Jest will run all test files that end with the name ".test.ts"
9497

95-
- jest for all new tests that do not require browser context (React+more)
96-
- Start watcher: `npm run jest`
97-
- Jest will run all test files that end with the name ".jest.ts"
98-
- karma + mocha is used for testing angularjs components. We do want to migrate these test to jest over time (if possible).
99-
- Start watcher: `npm run karma`
100-
- Karma+Mocha runs all files that end with the name "_specs.ts".
10198

10299
## Creating optimized release packages
103100

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
"roots": [
1414
"<rootDir>/public"
1515
],
16-
"testRegex": "(\\.|/)(jest)\\.(jsx?|tsx?)$",
16+
"testRegex": "(\\.|/)(test)\\.(jsx?|tsx?)$",
1717
"moduleFileExtensions": [
1818
"ts",
1919
"tsx",

karma.conf.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"grunt-contrib-copy": "~1.0.0",
4747
"grunt-contrib-cssmin": "~1.0.2",
4848
"grunt-exec": "^1.0.1",
49-
"grunt-karma": "~2.0.0",
5049
"grunt-notify": "^0.4.5",
5150
"grunt-postcss": "^0.8.0",
5251
"grunt-sass": "^2.0.0",
@@ -58,14 +57,6 @@
5857
"html-webpack-plugin": "^3.2.0",
5958
"husky": "^0.14.3",
6059
"jest": "^22.0.4",
61-
"karma": "1.7.0",
62-
"karma-chrome-launcher": "~2.2.0",
63-
"karma-expect": "~1.1.3",
64-
"karma-mocha": "~1.3.0",
65-
"karma-phantomjs-launcher": "1.0.4",
66-
"karma-sinon": "^1.0.5",
67-
"karma-sourcemap-loader": "^0.3.7",
68-
"karma-webpack": "^3.0.0",
6960
"lint-staged": "^6.0.0",
7061
"load-grunt-tasks": "3.5.2",
7162
"mini-css-extract-plugin": "^0.4.0",
@@ -112,7 +103,6 @@
112103
"test": "grunt test",
113104
"test:coverage": "grunt test --coverage=true",
114105
"lint": "tslint -c tslint.json --project tsconfig.json --type-check",
115-
"karma": "grunt karma:dev",
116106
"jest": "jest --notify --watch",
117107
"api-tests": "jest --notify --watch --config=tests/api/jest.js",
118108
"precommit": "lint-staged && grunt precommit"

0 commit comments

Comments
 (0)