Compare commits

...

14 Commits

Author SHA1 Message Date
Dimitris Sotirakis
63cb359220 Update grabpl version (#42091) 2021-11-22 18:02:08 +01:00
Dimitris Sotirakis
748824836f Remove Linux grabpl download step from Windows enterprise builds (#42065) 2021-11-22 13:15:18 +01:00
Dimitris Sotirakis
05bd79087a Remove grabpl step from Windows builds (#42052) 2021-11-22 12:02:37 +01:00
Dimitris Sotirakis
20745e2f71 Add deployment_tools_config.json to git and eslint ignore (#42040) 2021-11-22 11:19:32 +01:00
Dominik Prokop
71935ec4d7 [v8.3.0-beta1] Manual backports (#42032)
* Alerting: increase timeout for silences tests (#41918) (#41958)

(cherry picked from commit 81155e2d55)

Co-authored-by: Nathan Rodman <nathanrodman@gmail.com>

* Fix loop when cannot fetch roles (#41901) (#41945)

(cherry picked from commit d66158a042)

Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>

* ThresholdControls: Use correct scale key when calculating handle position (#41942) (#41971)

(cherry picked from commit 67f43cd7ab)

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>

* Candlestick: fix volume histogram height by using mapped field name (#41931) (#41934)

(cherry picked from commit 17c2f52dcf)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>

Co-authored-by: Grot (@grafanabot) <43478413+grafanabot@users.noreply.github.com>
Co-authored-by: Nathan Rodman <nathanrodman@gmail.com>
Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
2021-11-22 10:32:11 +01:00
Dimitris Sotirakis
d95a4c6488 Make integration tests depend on initialize for enterprise-release-* branches (#42004) (#42031) 2021-11-22 09:44:05 +01:00
Grot (@grafanabot)
94023f10a3 Make initialize depend on clone, only on enterprise pipelines (#41909) (#41910)
(cherry picked from commit 7dcc5ca199)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
2021-11-18 18:11:43 +02:00
Grot (@grafanabot)
a6ce53136c Run integration tests after initialize (#41906) (#41908)
(cherry picked from commit e8a2a82d5c)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
2021-11-18 18:00:35 +02:00
Grot (@grafanabot)
b4b13f8113 Disable lint-drone from release pipelines (#41899) (#41900)
(cherry picked from commit 53dc388dcf)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
2021-11-18 17:34:13 +02:00
Grot (@grafanabot)
591d789f38 Azure Monitor: Clean up fields when editing Metrics (#41762) (#41891)
(cherry picked from commit f8192bf428)

Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
2021-11-18 16:05:29 +01:00
Grot (@grafanabot)
fe082e2210 Update grabpl version to 2.6.1 (#41892) (#41896)
(cherry picked from commit c82a15eafb)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
2021-11-18 16:01:05 +01:00
Grot (@grafanabot)
3140f630c1 ReleaseNotes: Updated changelog and release notes for 8.2.5 (#41886) (#41887)
(cherry picked from commit daa3cb831d)
2021-11-18 15:02:10 +01:00
Zoltán Bedi
b7b5a59437 Update yarn.lock after version bump (#41884) 2021-11-18 14:57:58 +01:00
Grot (@grafanabot)
64c575c115 "Release: Updated versions in package to 8.3.0-beta.1" (#41877) 2021-11-18 13:59:05 +01:00
34 changed files with 646 additions and 496 deletions

View File

@@ -11,7 +11,7 @@ services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -106,7 +106,7 @@ services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -279,10 +279,20 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $DRONE_RUNNER_NAME
image: alpine:3.14.2
name: identify-runner
- commands:
- make gen-go
- ./bin/grabpl gen-version --build-id ${DRONE_BUILD_NUMBER}
- yarn install --immutable
image: grafana/build-container:1.4.5
name: initialize
- commands:
- apt-get update
- apt-get install -yq postgresql-client
@@ -343,7 +353,7 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -681,7 +691,7 @@ steps:
name: identify-runner
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/windows/grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/windows/grabpl.exe
-OutFile grabpl.exe
image: grafana/ci-wix:0.1.1
name: initialize
@@ -724,7 +734,7 @@ services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -814,7 +824,7 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -829,12 +839,6 @@ steps:
- yarn install --immutable
image: grafana/build-container:1.4.5
name: initialize
- commands:
- ./bin/grabpl verify-drone
depends_on:
- grabpl
image: byrnedo/alpine-curl:0.1.8
name: lint-drone
- commands:
- |-
echo -e "unknwon
@@ -1111,19 +1115,13 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
name: identify-runner
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/windows/grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/windows/grabpl.exe
-OutFile grabpl.exe
image: grafana/ci-wix:0.1.1
name: initialize
@@ -1186,7 +1184,7 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -1202,7 +1200,7 @@ steps:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/build-container:1.4.5
name: clone
name: clone-enterprise
- commands:
- mv bin/grabpl /tmp/
- rmdir bin
@@ -1216,15 +1214,9 @@ steps:
- ./bin/grabpl gen-version ${DRONE_TAG}
- yarn install --immutable
depends_on:
- grabpl
- clone-enterprise
image: grafana/build-container:1.4.5
name: initialize
- commands:
- ./bin/grabpl verify-drone
depends_on:
- grabpl
image: byrnedo/alpine-curl:0.1.8
name: lint-drone
- commands:
- |-
echo -e "unknwon
@@ -1291,7 +1283,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- grabpl
- initialize
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -1307,7 +1299,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- grabpl
- initialize
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -1474,7 +1466,7 @@ steps:
- dockerize -wait tcp://redis:6379/0 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- grabpl
- initialize
environment:
REDIS_URL: redis://redis:6379/0
image: grafana/build-container:1.4.5
@@ -1483,7 +1475,7 @@ steps:
- dockerize -wait tcp://memcached:11211 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- grabpl
- initialize
environment:
MEMCACHED_HOSTS: memcached:11211
image: grafana/build-container:1.4.5
@@ -1589,19 +1581,13 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
name: identify-runner
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/windows/grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/windows/grabpl.exe
-OutFile grabpl.exe
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
- cd grafana-enterprise
@@ -1662,7 +1648,7 @@ services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -1771,7 +1757,7 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -1786,12 +1772,6 @@ steps:
- yarn install --immutable
image: grafana/build-container:1.4.5
name: initialize
- commands:
- ./bin/grabpl verify-drone
depends_on:
- grabpl
image: byrnedo/alpine-curl:0.1.8
name: lint-drone
- commands:
- |-
echo -e "unknwon
@@ -2056,19 +2036,13 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
name: identify-runner
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/windows/grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/windows/grabpl.exe
-OutFile grabpl.exe
image: grafana/ci-wix:0.1.1
name: initialize
@@ -2132,7 +2106,7 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -2148,7 +2122,7 @@ steps:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/build-container:1.4.5
name: clone
name: clone-enterprise
- commands:
- mv bin/grabpl /tmp/
- rmdir bin
@@ -2162,15 +2136,9 @@ steps:
- ./bin/grabpl gen-version v7.3.0-test
- yarn install --immutable
depends_on:
- grabpl
- clone-enterprise
image: grafana/build-container:1.4.5
name: initialize
- commands:
- ./bin/grabpl verify-drone
depends_on:
- grabpl
image: byrnedo/alpine-curl:0.1.8
name: lint-drone
- commands:
- |-
echo -e "unknwon
@@ -2527,19 +2495,13 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
name: identify-runner
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/windows/grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/windows/grabpl.exe
-OutFile grabpl.exe
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
- cd grafana-enterprise
@@ -2601,7 +2563,7 @@ services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -2715,7 +2677,7 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -2729,12 +2691,6 @@ steps:
- yarn install --immutable
image: grafana/build-container:1.4.5
name: initialize
- commands:
- ./bin/grabpl verify-drone
depends_on:
- grabpl
image: byrnedo/alpine-curl:0.1.8
name: lint-drone
- commands:
- |-
echo -e "unknwon
@@ -2977,19 +2933,13 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
name: identify-runner
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/windows/grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/windows/grabpl.exe
-OutFile grabpl.exe
image: grafana/ci-wix:0.1.1
name: initialize
@@ -3048,7 +2998,7 @@ services:
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
@@ -3064,7 +3014,7 @@ steps:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/build-container:1.4.5
name: clone
name: clone-enterprise
- commands:
- mv bin/grabpl /tmp/
- rmdir bin
@@ -3077,15 +3027,9 @@ steps:
- ./bin/grabpl gen-version --build-id ${DRONE_BUILD_NUMBER}
- yarn install --immutable
depends_on:
- grabpl
- clone-enterprise
image: grafana/build-container:1.4.5
name: initialize
- commands:
- ./bin/grabpl verify-drone
depends_on:
- grabpl
image: byrnedo/alpine-curl:0.1.8
name: lint-drone
- commands:
- |-
echo -e "unknwon
@@ -3152,7 +3096,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- grabpl
- initialize
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -3168,7 +3112,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- grabpl
- initialize
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -3332,7 +3276,7 @@ steps:
- dockerize -wait tcp://redis:6379/0 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- grabpl
- initialize
environment:
REDIS_URL: redis://redis:6379/0
image: grafana/build-container:1.4.5
@@ -3341,7 +3285,7 @@ steps:
- dockerize -wait tcp://memcached:11211 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- grabpl
- initialize
environment:
MEMCACHED_HOSTS: memcached:11211
image: grafana/build-container:1.4.5
@@ -3447,19 +3391,13 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
name: identify-runner
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.0/windows/grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.6.2/windows/grabpl.exe
-OutFile grabpl.exe
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
- cd grafana-enterprise
@@ -3582,6 +3520,6 @@ kind: secret
name: drone_token
---
kind: signature
hmac: 98b4a289aefb0f9aaa664b34ed6d9b36707ec384e93b08eebc45bacecc0a0698
hmac: 5c5b90b18e6dacf446355a37979d19ba09ad6128a12a6fff2099fac3fff02b08
...

View File

@@ -7,3 +7,4 @@ data
dist
e2e/tmp
public/lib/monaco
deployment_tools_config.json

2
.gitignore vendored
View File

@@ -149,3 +149,5 @@ compilation-stats.json
# auto generated Go files
*_gen.go
deployment_tools_config.json

View File

@@ -5,6 +5,7 @@
### Bug fixes
- **Alerting:** Fix a bug where the metric in the evaluation string was not correctly populated. [#41731](https://github.com/grafana/grafana/pull/41731), [@JohnnyQQQQ](https://github.com/JohnnyQQQQ)
- **Alerting:** Fix no data behaviour in Legacy Alerting for alert rules using the AND operator. [#41305](https://github.com/grafana/grafana/pull/41305), [@gerobinson](https://github.com/gerobinson)
- **CloudMonitoring:** Ignore min and max aggregation in MQL queries. [#41302](https://github.com/grafana/grafana/pull/41302), [@sunker](https://github.com/sunker)
- **Dashboards:** 'Copy' is no longer added to new dashboard titles. [#41344](https://github.com/grafana/grafana/pull/41344), [@joshhunt](https://github.com/joshhunt)
- **DataProxy:** Fix overriding response body when response is a WebSocket upgrade. [#41364](https://github.com/grafana/grafana/pull/41364), [@marefr](https://github.com/marefr)
@@ -15,6 +16,14 @@
- **Tempo:** Fix validation of float durations. [#41400](https://github.com/grafana/grafana/pull/41400), [@ivanahuckova](https://github.com/ivanahuckova)
- **Tracing:** Correct tags for each span are shown. [#41473](https://github.com/grafana/grafana/pull/41473), [@ivanahuckova](https://github.com/ivanahuckova)
### Breaking changes
### Fix No Data behaviour in Legacy Alerting
In Grafana 8.2.5 and later, this change fixes a bug in the evaluation of alert rules when using the AND operator to compare two or more conditions. In Grafana 8.2.4 and earlier such alert rules would evaluate to `OK` if at least one, but not all, conditions returned no data. This change fixes that bug such that in Grafana 8.2.5 these alert rules now evaluate to `No Data`.
If an alert should evaluate to `OK` when one or all conditions return `No Data` then this can be done via changing `If no data or all values are null` to `OK`. However, this will not preserve the old behaviour in 8.2.4 where an alert will be `OK` if at least one, but not all, conditions return no data and then `No Data` if all conditions return `No Data`. Issue [#41305](https://github.com/grafana/grafana/issues/41305)
<!-- 8.2.5 END -->
<!-- 8.2.4 START -->

View File

@@ -11,6 +11,7 @@ list = false
### Bug fixes
- **Alerting:** Fix a bug where the metric in the evaluation string was not correctly populated. [#41731](https://github.com/grafana/grafana/pull/41731), [@JohnnyQQQQ](https://github.com/JohnnyQQQQ)
- **Alerting:** Fix no data behaviour in Legacy Alerting for alert rules using the AND operator. [#41305](https://github.com/grafana/grafana/pull/41305), [@gerobinson](https://github.com/gerobinson)
- **CloudMonitoring:** Ignore min and max aggregation in MQL queries. [#41302](https://github.com/grafana/grafana/pull/41302), [@sunker](https://github.com/sunker)
- **Dashboards:** 'Copy' is no longer added to new dashboard titles. [#41344](https://github.com/grafana/grafana/pull/41344), [@joshhunt](https://github.com/joshhunt)
- **DataProxy:** Fix overriding response body when response is a WebSocket upgrade. [#41364](https://github.com/grafana/grafana/pull/41364), [@marefr](https://github.com/marefr)
@@ -20,3 +21,11 @@ list = false
- **Plugins:** Ensure consistent plugin settings list response. [#41346](https://github.com/grafana/grafana/pull/41346), [@wbrowne](https://github.com/wbrowne)
- **Tempo:** Fix validation of float durations. [#41400](https://github.com/grafana/grafana/pull/41400), [@ivanahuckova](https://github.com/ivanahuckova)
- **Tracing:** Correct tags for each span are shown. [#41473](https://github.com/grafana/grafana/pull/41473), [@ivanahuckova](https://github.com/ivanahuckova)
### Breaking changes
### Fix No Data behaviour in Legacy Alerting
In Grafana 8.2.5 and later, this change fixes a bug in the evaluation of alert rules when using the AND operator to compare two or more conditions. In Grafana 8.2.4 and earlier such alert rules would evaluate to `OK` if at least one, but not all, conditions returned no data. This change fixes that bug such that in Grafana 8.2.5 these alert rules now evaluate to `No Data`.
If an alert should evaluate to `OK` when one or all conditions return `No Data` then this can be done via changing `If no data or all values are null` to `OK`. However, this will not preserve the old behaviour in 8.2.4 where an alert will be `OK` if at least one, but not all, conditions return no data and then `No Data` if all conditions return `No Data`. Issue [#41305](https://github.com/grafana/grafana/issues/41305)

View File

@@ -1,6 +1,8 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"packages": ["packages/*"],
"version": "8.3.0-pre"
"packages": [
"packages/*"
],
"version": "8.3.0-beta.1"
}

View File

@@ -3,7 +3,7 @@
"license": "AGPL-3.0-only",
"private": true,
"name": "grafana",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"repository": "github:grafana/grafana",
"scripts": {
"api-tests": "jest --notify --watch --config=devenv/e2e-api-tests/jest.js",

View File

@@ -2,7 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/data",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Grafana Data Library",
"keywords": [
"typescript"
@@ -22,7 +22,7 @@
},
"dependencies": {
"@braintree/sanitize-url": "5.0.2",
"@grafana/schema": "8.3.0-pre",
"@grafana/schema": "8.3.0-beta.1",
"@types/d3-interpolate": "^1.4.0",
"d3-interpolate": "1.4.0",
"date-fns": "2.21.3",

View File

@@ -2,7 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/e2e-selectors",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Grafana End-to-End Test Selectors Library",
"keywords": [
"cli",

View File

@@ -2,7 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/e2e",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Grafana End-to-End Test Library",
"keywords": [
"cli",
@@ -49,7 +49,7 @@
"@babel/core": "7.14.6",
"@babel/preset-env": "7.14.7",
"@cypress/webpack-preprocessor": "5.9.1",
"@grafana/e2e-selectors": "8.3.0-pre",
"@grafana/e2e-selectors": "8.3.0-beta.1",
"@grafana/tsconfig": "^1.0.0-rc1",
"@mochajs/json-file-reporter": "^1.2.0",
"babel-loader": "8.2.2",

View File

@@ -2,7 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/runtime",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Grafana Runtime Library",
"keywords": [
"grafana",
@@ -23,9 +23,9 @@
},
"dependencies": {
"@emotion/css": "11.1.3",
"@grafana/data": "8.3.0-pre",
"@grafana/e2e-selectors": "8.3.0-pre",
"@grafana/ui": "8.3.0-pre",
"@grafana/data": "8.3.0-beta.1",
"@grafana/e2e-selectors": "8.3.0-beta.1",
"@grafana/ui": "8.3.0-beta.1",
"@sentry/browser": "5.25.0",
"history": "4.10.1",
"lodash": "4.17.21",

View File

@@ -2,7 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/schema",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Grafana Schema Library",
"keywords": [
"typescript"

View File

@@ -2,7 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/toolkit",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Grafana Toolkit",
"keywords": [
"grafana",
@@ -28,10 +28,10 @@
"dependencies": {
"@babel/core": "7.13.14",
"@babel/preset-env": "7.13.12",
"@grafana/data": "8.3.0-pre",
"@grafana/data": "8.3.0-beta.1",
"@grafana/eslint-config": "2.5.1",
"@grafana/tsconfig": "^1.0.0-rc1",
"@grafana/ui": "8.3.0-pre",
"@grafana/ui": "8.3.0-beta.1",
"@jest/core": "26.6.3",
"@rushstack/eslint-patch": "1.0.6",
"@types/command-exists": "^1.2.0",

View File

@@ -2,7 +2,7 @@
"author": "Grafana Labs",
"license": "Apache-2.0",
"name": "@grafana/ui",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Grafana Components Library",
"keywords": [
"grafana",
@@ -33,9 +33,9 @@
"@emotion/css": "11.1.3",
"@emotion/react": "11.1.5",
"@grafana/aws-sdk": "0.0.3",
"@grafana/data": "8.3.0-pre",
"@grafana/e2e-selectors": "8.3.0-pre",
"@grafana/schema": "8.3.0-pre",
"@grafana/data": "8.3.0-beta.1",
"@grafana/e2e-selectors": "8.3.0-beta.1",
"@grafana/schema": "8.3.0-beta.1",
"@grafana/slate-react": "0.22.10-grafana",
"@monaco-editor/react": "4.2.2",
"@popperjs/core": "2.5.4",

View File

@@ -6,6 +6,7 @@ import {
DataFrame,
DataHoverClearEvent,
DataHoverEvent,
Field,
FieldMatcherID,
fieldMatchers,
LegacyGraphHoverEvent,
@@ -44,8 +45,8 @@ export interface GraphNGProps extends Themeable2 {
legend: VizLegendOptions;
fields?: XYFieldMatchers; // default will assume timeseries data
renderers?: Renderers;
tweakScale?: (opts: ScaleProps) => ScaleProps;
tweakAxis?: (opts: AxisProps) => AxisProps;
tweakScale?: (opts: ScaleProps, forField: Field) => ScaleProps;
tweakAxis?: (opts: AxisProps, forField: Field) => AxisProps;
onLegendClick?: (event: GraphNGLegendEvent) => void;
children?: (builder: UPlotConfigBuilder, alignedFrame: DataFrame) => React.ReactNode;
prepConfig: (alignedFrame: DataFrame, allFrames: DataFrame[], getTimeRange: () => TimeRange) => UPlotConfigBuilder;

View File

@@ -1,6 +1,8 @@
import { XYFieldMatchers } from './types';
import { ArrayVector, DataFrame, FieldType, outerJoinDataFrames } from '@grafana/data';
import { ArrayVector, DataFrame, FieldConfig, FieldType, outerJoinDataFrames } from '@grafana/data';
import { nullToUndefThreshold } from './nullToUndefThreshold';
import { AxisPlacement, GraphFieldConfig, ScaleDistribution, ScaleDistributionConfig } from '@grafana/schema';
import { FIXED_UNIT } from './GraphNG';
// will mutate the DataFrame's fields' values
function applySpanNullsThresholds(frame: DataFrame) {
@@ -38,3 +40,36 @@ export function preparePlotFrame(frames: DataFrame[], dimFields: XYFieldMatchers
return alignedFrame && applySpanNullsThresholds(alignedFrame);
}
export function buildScaleKey(config: FieldConfig<GraphFieldConfig>) {
const defaultPart = 'na';
const scaleRange = `${config.min !== undefined ? config.min : defaultPart}-${
config.max !== undefined ? config.max : defaultPart
}`;
const scaleSoftRange = `${config.custom?.axisSoftMin !== undefined ? config.custom.axisSoftMin : defaultPart}-${
config.custom?.axisSoftMax !== undefined ? config.custom.axisSoftMax : defaultPart
}`;
const scalePlacement = `${
config.custom?.axisPlacement !== undefined ? config.custom?.axisPlacement : AxisPlacement.Auto
}`;
const scaleUnit = config.unit ?? FIXED_UNIT;
const scaleDistribution = config.custom?.scaleDistribution
? getScaleDistributionPart(config.custom.scaleDistribution)
: ScaleDistribution.Linear;
const scaleLabel = Boolean(config.custom?.axisLabel) ? config.custom!.axisLabel : defaultPart;
return `${scaleUnit}/${scaleRange}/${scaleSoftRange}/${scalePlacement}/${scaleDistribution}/${scaleLabel}`;
}
function getScaleDistributionPart(config: ScaleDistributionConfig) {
if (config.type === ScaleDistribution.Log) {
return `${config.type}${config.log}`;
}
return config.type;
}

View File

@@ -14,7 +14,6 @@ import {
} from '@grafana/data';
import { UPlotConfigBuilder, UPlotConfigPrepFn } from '../uPlot/config/UPlotConfigBuilder';
import { FIXED_UNIT } from '../GraphNG/GraphNG';
import {
AxisPlacement,
GraphDrawStyle,
@@ -24,11 +23,10 @@ import {
ScaleDirection,
ScaleOrientation,
VizLegendOptions,
ScaleDistributionConfig,
ScaleDistribution,
} from '@grafana/schema';
import { collectStackingGroups, orderIdsByCalcs, preparePlotData } from '../uPlot/utils';
import uPlot from 'uplot';
import { buildScaleKey } from '../GraphNG/utils';
const defaultFormatter = (v: any) => (v == null ? '-' : v.toFixed(1));
@@ -146,17 +144,20 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{ sync: DashboardCursor
// The builder will manage unique scaleKeys and combine where appropriate
builder.addScale(
tweakScale({
scaleKey,
orientation: ScaleOrientation.Vertical,
direction: ScaleDirection.Up,
distribution: customConfig.scaleDistribution?.type,
log: customConfig.scaleDistribution?.log,
min: field.config.min,
max: field.config.max,
softMin: customConfig.axisSoftMin,
softMax: customConfig.axisSoftMax,
})
tweakScale(
{
scaleKey,
orientation: ScaleOrientation.Vertical,
direction: ScaleDirection.Up,
distribution: customConfig.scaleDistribution?.type,
log: customConfig.scaleDistribution?.log,
min: field.config.min,
max: field.config.max,
softMin: customConfig.axisSoftMin,
softMax: customConfig.axisSoftMax,
},
field
)
);
if (!yScaleKey) {
@@ -165,15 +166,18 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{ sync: DashboardCursor
if (customConfig.axisPlacement !== AxisPlacement.Hidden) {
builder.addAxis(
tweakAxis({
scaleKey,
label: customConfig.axisLabel,
size: customConfig.axisWidth,
placement: customConfig.axisPlacement ?? AxisPlacement.Auto,
formatValue: (v) => formattedValueToString(fmt(v)),
theme,
grid: { show: customConfig.axisGridShow },
})
tweakAxis(
{
scaleKey,
label: customConfig.axisLabel,
size: customConfig.axisWidth,
placement: customConfig.axisPlacement ?? AxisPlacement.Auto,
formatValue: (v) => formattedValueToString(fmt(v)),
theme,
grid: { show: customConfig.axisGridShow },
},
field
)
);
}
@@ -435,34 +439,3 @@ export function getNamesToFieldIndex(frame: DataFrame, allFrames: DataFrame[]):
});
return originNames;
}
function buildScaleKey(config: FieldConfig<GraphFieldConfig>) {
const defaultPart = 'na';
const scaleRange = `${config.min !== undefined ? config.min : defaultPart}-${
config.max !== undefined ? config.max : defaultPart
}`;
const scaleSoftRange = `${config.custom?.axisSoftMin !== undefined ? config.custom.axisSoftMin : defaultPart}-${
config.custom?.axisSoftMax !== undefined ? config.custom.axisSoftMax : defaultPart
}`;
const scalePlacement = `${config.custom?.axisPlacement !== undefined ? config.custom?.axisPlacement : defaultPart}`;
const scaleUnit = config.unit ?? FIXED_UNIT;
const scaleDistribution = config.custom?.scaleDistribution
? getScaleDistributionPart(config.custom.scaleDistribution)
: ScaleDistribution.Linear;
const scaleLabel = Boolean(config.custom?.axisLabel) ? config.custom!.axisLabel : defaultPart;
return `${scaleUnit}/${scaleRange}/${scaleSoftRange}/${scalePlacement}/${scaleDistribution}/${scaleLabel}`;
}
function getScaleDistributionPart(config: ScaleDistributionConfig) {
if (config.type === ScaleDistribution.Log) {
return `${config.type}${config.log}`;
}
return config.type;
}

View File

@@ -265,7 +265,7 @@ export { UPlotConfigPrepFn } from './uPlot/config/UPlotConfigBuilder';
export { GraphNG, GraphNGProps, FIXED_UNIT } from './GraphNG/GraphNG';
export { TimeSeries } from './TimeSeries/TimeSeries';
export { useGraphNGContext } from './GraphNG/hooks';
export { preparePlotFrame } from './GraphNG/utils';
export { preparePlotFrame, buildScaleKey } from './GraphNG/utils';
export { GraphNGLegendEvent } from './GraphNG/types';
export * from './PanelChrome/types';
export { EmotionPerfTest } from './ThemeDemos/EmotionPerfTest';

View File

@@ -4,6 +4,7 @@ import {
DataFrame,
DefaultTimeZone,
EventBus,
Field,
getTimeZoneInfo,
GrafanaTheme2,
TimeRange,
@@ -287,8 +288,8 @@ type UPlotConfigPrepOpts<T extends Record<string, any> = {}> = {
eventBus: EventBus;
allFrames: DataFrame[];
renderers?: Renderers;
tweakScale?: (opts: ScaleProps) => ScaleProps;
tweakAxis?: (opts: AxisProps) => AxisProps;
tweakScale?: (opts: ScaleProps, forField: Field) => ScaleProps;
tweakAxis?: (opts: AxisProps, forField: Field) => AxisProps;
} & T;
/** @alpha */

View File

@@ -1,6 +1,6 @@
{
"name": "@jaegertracing/jaeger-ui-components",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -30,8 +30,8 @@
"dependencies": {
"@emotion/css": "11.1.3",
"@emotion/react": "11.1.5",
"@grafana/data": "8.3.0-pre",
"@grafana/ui": "8.3.0-pre",
"@grafana/data": "8.3.0-beta.1",
"@grafana/ui": "8.3.0-beta.1",
"chance": "^1.0.10",
"classnames": "^2.2.5",
"combokeys": "^3.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@grafana-plugins/input-datasource",
"version": "8.3.0-pre",
"version": "8.3.0-beta.1",
"description": "Input Datasource",
"private": true,
"repository": {
@@ -21,9 +21,9 @@
"webpack": "5.58.1"
},
"dependencies": {
"@grafana/data": "8.3.0-pre",
"@grafana/toolkit": "8.3.0-pre",
"@grafana/ui": "8.3.0-pre",
"@grafana/data": "8.3.0-beta.1",
"@grafana/toolkit": "8.3.0-beta.1",
"@grafana/ui": "8.3.0-beta.1",
"jquery": "3.5.1",
"react": "17.0.1",
"react-dom": "17.0.1",

View File

@@ -60,11 +60,16 @@ export const fetchUserRoles = async (userId: number, orgId?: number): Promise<Ro
if (orgId) {
userRolesUrl += `?targetOrgId=${orgId}`;
}
const roles = await getBackendSrv().get(userRolesUrl);
if (!roles || !roles.length) {
try {
const roles = await getBackendSrv().get(userRolesUrl);
if (!roles || !roles.length) {
return [];
}
return roles;
} catch (error) {
error.isHandled = true;
return [];
}
return roles;
};
export const updateUserRoles = (roleUids: string[], userId: number, orgId?: number) => {

View File

@@ -17,6 +17,8 @@ import userEvent from '@testing-library/user-event';
jest.mock('./api/alertmanager');
const TEST_TIMEOUT = 60000;
const mocks = {
api: {
fetchSilences: typeAsJestMock(fetchSilences),
@@ -99,53 +101,65 @@ describe('Silences', () => {
setDataSourceSrv(new MockDataSourceSrv(dataSources));
});
it('loads and shows silences', async () => {
renderSilences();
await waitFor(() => expect(mocks.api.fetchSilences).toHaveBeenCalled());
await waitFor(() => expect(mocks.api.fetchAlerts).toHaveBeenCalled());
it(
'loads and shows silences',
async () => {
renderSilences();
await waitFor(() => expect(mocks.api.fetchSilences).toHaveBeenCalled());
await waitFor(() => expect(mocks.api.fetchAlerts).toHaveBeenCalled());
expect(ui.silencesTable.query()).not.toBeNull();
expect(ui.silencesTable.query()).not.toBeNull();
const silences = ui.silenceRow.queryAll();
expect(silences).toHaveLength(2);
expect(silences[0]).toHaveTextContent('foo=bar');
expect(silences[1]).toHaveTextContent('foo!=bar');
});
const silences = ui.silenceRow.queryAll();
expect(silences).toHaveLength(2);
expect(silences[0]).toHaveTextContent('foo=bar');
expect(silences[1]).toHaveTextContent('foo!=bar');
},
TEST_TIMEOUT
);
it('shows the correct number of silenced alerts', async () => {
mocks.api.fetchAlerts.mockImplementation(() => {
return Promise.resolve([
mockAlertmanagerAlert({
labels: { foo: 'bar', buzz: 'bazz' },
status: { state: AlertState.Suppressed, silencedBy: ['12345'], inhibitedBy: [] },
}),
mockAlertmanagerAlert({
labels: { foo: 'bar', buzz: 'bazz' },
status: { state: AlertState.Suppressed, silencedBy: ['12345'], inhibitedBy: [] },
}),
]);
});
it(
'shows the correct number of silenced alerts',
async () => {
mocks.api.fetchAlerts.mockImplementation(() => {
return Promise.resolve([
mockAlertmanagerAlert({
labels: { foo: 'bar', buzz: 'bazz' },
status: { state: AlertState.Suppressed, silencedBy: ['12345'], inhibitedBy: [] },
}),
mockAlertmanagerAlert({
labels: { foo: 'bar', buzz: 'bazz' },
status: { state: AlertState.Suppressed, silencedBy: ['12345'], inhibitedBy: [] },
}),
]);
});
renderSilences();
await waitFor(() => expect(mocks.api.fetchSilences).toHaveBeenCalled());
await waitFor(() => expect(mocks.api.fetchAlerts).toHaveBeenCalled());
renderSilences();
await waitFor(() => expect(mocks.api.fetchSilences).toHaveBeenCalled());
await waitFor(() => expect(mocks.api.fetchAlerts).toHaveBeenCalled());
const silencedAlertRows = ui.silencedAlertCell.getAll(ui.silencesTable.get());
expect(silencedAlertRows).toHaveLength(2);
expect(silencedAlertRows[0]).toHaveTextContent('2');
expect(silencedAlertRows[1]).toHaveTextContent('0');
});
const silencedAlertRows = ui.silencedAlertCell.getAll(ui.silencesTable.get());
expect(silencedAlertRows).toHaveLength(2);
expect(silencedAlertRows[0]).toHaveTextContent('2');
expect(silencedAlertRows[1]).toHaveTextContent('0');
},
TEST_TIMEOUT
);
it('filters silences by matchers', async () => {
renderSilences();
await waitFor(() => expect(mocks.api.fetchSilences).toHaveBeenCalled());
await waitFor(() => expect(mocks.api.fetchAlerts).toHaveBeenCalled());
it(
'filters silences by matchers',
async () => {
renderSilences();
await waitFor(() => expect(mocks.api.fetchSilences).toHaveBeenCalled());
await waitFor(() => expect(mocks.api.fetchAlerts).toHaveBeenCalled());
const queryBar = ui.queryBar.get();
userEvent.paste(queryBar, 'foo=bar');
const queryBar = ui.queryBar.get();
userEvent.paste(queryBar, 'foo=bar');
await waitFor(() => expect(ui.silenceRow.getAll()).toHaveLength(1));
});
await waitFor(() => expect(ui.silenceRow.getAll()).toHaveLength(1));
},
TEST_TIMEOUT
);
});
describe('Silence edit', () => {
@@ -157,94 +171,102 @@ describe('Silence edit', () => {
setDataSourceSrv(new MockDataSourceSrv(dataSources));
});
it('prefills the matchers field with matchers params', async () => {
renderSilences(
`${baseUrlPath}?matchers=${encodeURIComponent('foo=bar,bar=~ba.+,hello!=world,cluster!~us-central.*')}`
);
await waitFor(() => expect(ui.editor.durationField.query()).not.toBeNull());
it(
'prefills the matchers field with matchers params',
async () => {
renderSilences(
`${baseUrlPath}?matchers=${encodeURIComponent('foo=bar,bar=~ba.+,hello!=world,cluster!~us-central.*')}`
);
await waitFor(() => expect(ui.editor.durationField.query()).not.toBeNull());
const matchers = ui.editor.matchersField.queryAll();
expect(matchers).toHaveLength(4);
const matchers = ui.editor.matchersField.queryAll();
expect(matchers).toHaveLength(4);
expect(ui.editor.matcherName.query(matchers[0])).toHaveValue('foo');
expect(ui.editor.matcherOperator(MatcherOperator.equal).query(matchers[0])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[0])).toHaveValue('bar');
expect(ui.editor.matcherName.query(matchers[0])).toHaveValue('foo');
expect(ui.editor.matcherOperator(MatcherOperator.equal).query(matchers[0])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[0])).toHaveValue('bar');
expect(ui.editor.matcherName.query(matchers[1])).toHaveValue('bar');
expect(ui.editor.matcherOperator(MatcherOperator.regex).query(matchers[1])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[1])).toHaveValue('ba.+');
expect(ui.editor.matcherName.query(matchers[1])).toHaveValue('bar');
expect(ui.editor.matcherOperator(MatcherOperator.regex).query(matchers[1])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[1])).toHaveValue('ba.+');
expect(ui.editor.matcherName.query(matchers[2])).toHaveValue('hello');
expect(ui.editor.matcherOperator(MatcherOperator.notEqual).query(matchers[2])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[2])).toHaveValue('world');
expect(ui.editor.matcherName.query(matchers[2])).toHaveValue('hello');
expect(ui.editor.matcherOperator(MatcherOperator.notEqual).query(matchers[2])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[2])).toHaveValue('world');
expect(ui.editor.matcherName.query(matchers[3])).toHaveValue('cluster');
expect(ui.editor.matcherOperator(MatcherOperator.notRegex).query(matchers[3])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[3])).toHaveValue('us-central.*');
});
expect(ui.editor.matcherName.query(matchers[3])).toHaveValue('cluster');
expect(ui.editor.matcherOperator(MatcherOperator.notRegex).query(matchers[3])).not.toBeNull();
expect(ui.editor.matcherValue.query(matchers[3])).toHaveValue('us-central.*');
},
TEST_TIMEOUT
);
it('creates a new silence', async () => {
renderSilences(baseUrlPath);
await waitFor(() => expect(ui.editor.durationField.query()).not.toBeNull());
it(
'creates a new silence',
async () => {
renderSilences(baseUrlPath);
await waitFor(() => expect(ui.editor.durationField.query()).not.toBeNull());
const start = new Date();
const end = new Date(start.getTime() + 24 * 60 * 60 * 1000);
const start = new Date();
const end = new Date(start.getTime() + 24 * 60 * 60 * 1000);
const startDateString = dateTime(start).format('YYYY-MM-DD');
const endDateString = dateTime(end).format('YYYY-MM-DD');
const startDateString = dateTime(start).format('YYYY-MM-DD');
const endDateString = dateTime(end).format('YYYY-MM-DD');
userEvent.clear(ui.editor.durationInput.get());
userEvent.type(ui.editor.durationInput.get(), '1d');
userEvent.clear(ui.editor.durationInput.get());
userEvent.type(ui.editor.durationInput.get(), '1d');
await waitFor(() => expect(ui.editor.durationInput.query()).toHaveValue('1d'));
await waitFor(() => expect(ui.editor.timeRange.get()).toHaveTextContent(startDateString));
await waitFor(() => expect(ui.editor.timeRange.get()).toHaveTextContent(endDateString));
await waitFor(() => expect(ui.editor.durationInput.query()).toHaveValue('1d'));
await waitFor(() => expect(ui.editor.timeRange.get()).toHaveTextContent(startDateString));
await waitFor(() => expect(ui.editor.timeRange.get()).toHaveTextContent(endDateString));
userEvent.type(ui.editor.matcherName.get(), 'foo');
userEvent.type(ui.editor.matcherOperatorSelect.get(), '=');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.get(), 'bar');
userEvent.type(ui.editor.matcherName.get(), 'foo');
userEvent.type(ui.editor.matcherOperatorSelect.get(), '=');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.get(), 'bar');
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
userEvent.click(ui.editor.addMatcherButton.get(), undefined, { skipPointerEventsCheck: true });
userEvent.type(ui.editor.matcherName.getAll()[1], 'bar');
userEvent.type(ui.editor.matcherOperatorSelect.getAll()[1], '!=');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.getAll()[1], 'buzz');
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
userEvent.click(ui.editor.addMatcherButton.get(), undefined, { skipPointerEventsCheck: true });
userEvent.type(ui.editor.matcherName.getAll()[1], 'bar');
userEvent.type(ui.editor.matcherOperatorSelect.getAll()[1], '!=');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.getAll()[1], 'buzz');
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
userEvent.click(ui.editor.addMatcherButton.get(), undefined, { skipPointerEventsCheck: true });
userEvent.type(ui.editor.matcherName.getAll()[2], 'region');
userEvent.type(ui.editor.matcherOperatorSelect.getAll()[2], '=~');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.getAll()[2], 'us-west-.*');
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
userEvent.click(ui.editor.addMatcherButton.get(), undefined, { skipPointerEventsCheck: true });
userEvent.type(ui.editor.matcherName.getAll()[2], 'region');
userEvent.type(ui.editor.matcherOperatorSelect.getAll()[2], '=~');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.getAll()[2], 'us-west-.*');
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
userEvent.click(ui.editor.addMatcherButton.get(), undefined, { skipPointerEventsCheck: true });
userEvent.type(ui.editor.matcherName.getAll()[3], 'env');
userEvent.type(ui.editor.matcherOperatorSelect.getAll()[3], '!~');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.getAll()[3], 'dev|staging');
// TODO remove skipPointerEventsCheck once https://github.com/jsdom/jsdom/issues/3232 is fixed
userEvent.click(ui.editor.addMatcherButton.get(), undefined, { skipPointerEventsCheck: true });
userEvent.type(ui.editor.matcherName.getAll()[3], 'env');
userEvent.type(ui.editor.matcherOperatorSelect.getAll()[3], '!~');
userEvent.tab();
userEvent.type(ui.editor.matcherValue.getAll()[3], 'dev|staging');
userEvent.type(ui.editor.comment.get(), 'Test');
userEvent.type(ui.editor.createdBy.get(), 'Homer Simpson');
userEvent.type(ui.editor.comment.get(), 'Test');
userEvent.type(ui.editor.createdBy.get(), 'Homer Simpson');
userEvent.click(ui.editor.submit.get());
userEvent.click(ui.editor.submit.get());
await waitFor(() =>
expect(mocks.api.createOrUpdateSilence).toHaveBeenCalledWith(
'grafana',
expect.objectContaining({
comment: 'Test',
createdBy: 'Homer Simpson',
matchers: [
{ isEqual: true, isRegex: false, name: 'foo', value: 'bar' },
{ isEqual: false, isRegex: false, name: 'bar', value: 'buzz' },
{ isEqual: true, isRegex: true, name: 'region', value: 'us-west-.*' },
{ isEqual: false, isRegex: true, name: 'env', value: 'dev|staging' },
],
})
)
);
});
await waitFor(() =>
expect(mocks.api.createOrUpdateSilence).toHaveBeenCalledWith(
'grafana',
expect.objectContaining({
comment: 'Test',
createdBy: 'Homer Simpson',
matchers: [
{ isEqual: true, isRegex: false, name: 'foo', value: 'bar' },
{ isEqual: false, isRegex: false, name: 'bar', value: 'buzz' },
{ isEqual: true, isRegex: true, name: 'region', value: 'us-west-.*' },
{ isEqual: false, isRegex: true, name: 'env', value: 'dev|staging' },
],
})
)
);
},
TEST_TIMEOUT
);
});

View File

@@ -109,46 +109,8 @@ describe('Azure Monitor QueryEditor', () => {
azureMonitor: {
...mockQuery.azureMonitor,
metricName: 'metric-b',
},
});
});
it('should auto select a default aggregation if none exists once a metric is selected', async () => {
const mockDatasource = createMockDatasource();
const onChange = jest.fn();
const mockQuery = createMockQuery();
(mockQuery.azureMonitor ?? {}).aggregation = undefined;
mockDatasource.getMetricNames = jest.fn().mockResolvedValue([
{
value: 'metric-a',
text: 'Metric A',
},
{
value: 'metric-b',
text: 'Metric B',
},
]);
render(
<MetricsQueryEditor
subscriptionId="123"
query={createMockQuery()}
datasource={mockDatasource}
variableOptionGroup={variableOptionGroup}
onChange={onChange}
setError={() => {}}
/>
);
await waitFor(() => expect(screen.getByTestId('azure-monitor-metrics-query-editor')).toBeInTheDocument());
const metrics = await screen.findByLabelText('Metric');
await selectOptionInTest(metrics, 'Metric B');
expect(onChange).toHaveBeenLastCalledWith({
...mockQuery,
azureMonitor: {
...mockQuery.azureMonitor,
metricName: 'metric-b',
aggregation: 'Average',
aggregation: undefined,
timeGrain: '',
},
});
});

View File

@@ -2,6 +2,7 @@ import { renderHook } from '@testing-library/react-hooks';
import {
DataHook,
updateSubscriptions,
useAsyncState,
useMetricNames,
useResourceGroups,
@@ -340,8 +341,82 @@ describe('AzureMonitor: metrics dataHooks', () => {
expect(onChange).toHaveBeenCalledWith({
...query,
azureMonitor: scenario.expectedClearedQueryPartial,
azureMonitor: {
...scenario.expectedClearedQueryPartial,
dimensionFilters: [],
timeGrain: '',
},
});
});
});
});
describe('AzureMonitor: updateSubscriptions', () => {
const bareQuery = {
refId: 'A',
queryType: AzureQueryType.AzureMonitor,
};
[
{
description: 'should not update with no subscriptions',
query: bareQuery,
subscriptionOptions: [],
},
{
description: 'should not update with the subscription as an option',
query: { ...bareQuery, subscription: 'foo' },
subscriptionOptions: [{ label: 'foo', value: 'foo' }],
},
{
description: 'should update with the first subscription',
query: { ...bareQuery },
subscriptionOptions: [{ label: 'foo', value: 'foo' }],
onChangeArgs: {
...bareQuery,
subscription: 'foo',
azureMonitor: {
dimensionFilters: [],
timeGrain: '',
},
},
},
{
description: 'should update with the default subscription if the current subsription does not exists',
query: { ...bareQuery, subscription: 'bar' },
subscriptionOptions: [{ label: 'foo', value: 'foo' }],
onChangeArgs: {
...bareQuery,
subscription: 'foo',
azureMonitor: {
dimensionFilters: [],
timeGrain: '',
},
},
},
{
description: 'should clean up if neither the default sub nor the current sub exists',
query: { ...bareQuery, subscription: 'bar' },
subscriptionOptions: [{ label: 'foo', value: 'foo' }],
defaultSubscription: 'foobar',
onChangeArgs: {
...bareQuery,
subscription: '',
azureMonitor: {
dimensionFilters: [],
timeGrain: '',
},
},
},
].forEach((test) => {
it(test.description, () => {
const onChange = jest.fn();
updateSubscriptions(test.query, test.subscriptionOptions, onChange, test.defaultSubscription);
if (test.onChangeArgs) {
expect(onChange).toHaveBeenCalledWith(test.onChangeArgs);
} else {
expect(onChange).not.toHaveBeenCalled();
}
});
});
});

View File

@@ -55,8 +55,38 @@ export function useAsyncState<T>(asyncFn: () => Promise<T>, setError: Function,
return finalValue;
}
export const useSubscriptions: DataHook = (query, datasource, onChange, setError) => {
export const updateSubscriptions = (
query: AzureMonitorQuery,
subscriptionOptions: AzureMonitorOption[],
onChange: OnChangeFn,
defaultSubscription?: string
) => {
const { subscription } = query;
// Return early if subscriptions havent loaded, or if the query already has a subscription
if (!subscriptionOptions.length || (subscription && hasOption(subscriptionOptions, subscription))) {
return;
}
const defaultSub = defaultSubscription || subscriptionOptions[0].value;
if (!subscription && defaultSub && hasOption(subscriptionOptions, defaultSub)) {
onChange(setSubscriptionID(query, defaultSub));
}
// Check if the current subscription is in the list of subscriptions
if (subscription && !hasOption(subscriptionOptions, subscription)) {
if (hasOption(subscriptionOptions, defaultSub)) {
// Use the default sub if is on theh list
onChange(setSubscriptionID(query, defaultSub));
} else {
// Neither the current subscription nor the defaultSub is on the list, remove it
onChange(setSubscriptionID(query, ''));
}
}
};
export const useSubscriptions: DataHook = (query, datasource, onChange, setError) => {
const defaultSubscription = datasource.azureMonitorDatasource.defaultSubscriptionId;
const subscriptionOptions = useAsyncState(
@@ -69,17 +99,8 @@ export const useSubscriptions: DataHook = (query, datasource, onChange, setError
);
useEffect(() => {
// Return early if subscriptions havent loaded, or if the query already has a subscription
if (!subscriptionOptions.length || (subscription && hasOption(subscriptionOptions, subscription))) {
return;
}
const defaultSub = defaultSubscription || subscriptionOptions[0].value;
if (!subscription && defaultSub && hasOption(subscriptionOptions, defaultSub)) {
onChange(setSubscriptionID(query, defaultSub));
}
}, [subscriptionOptions, query, subscription, defaultSubscription, onChange]);
updateSubscriptions(query, subscriptionOptions, onChange, defaultSubscription);
}, [subscriptionOptions, query, defaultSubscription, onChange]);
return subscriptionOptions;
};

View File

@@ -11,6 +11,13 @@ export function setSubscriptionID(query: AzureMonitorQuery, subscriptionID: stri
azureMonitor: {
...query.azureMonitor,
resourceGroup: undefined,
metricDefinition: undefined,
metricNamespace: undefined,
resourceName: undefined,
metricName: undefined,
aggregation: undefined,
timeGrain: '',
dimensionFilters: [],
},
};
}
@@ -25,7 +32,13 @@ export function setResourceGroup(query: AzureMonitorQuery, resourceGroup: string
azureMonitor: {
...query.azureMonitor,
resourceGroup: resourceGroup,
metricDefinition: undefined,
metricNamespace: undefined,
resourceName: undefined,
metricName: undefined,
aggregation: undefined,
timeGrain: '',
dimensionFilters: [],
},
};
}
@@ -44,6 +57,9 @@ export function setResourceType(query: AzureMonitorQuery, resourceType: string |
resourceName: undefined,
metricNamespace: undefined,
metricName: undefined,
aggregation: undefined,
timeGrain: '',
dimensionFilters: [],
},
};
@@ -60,6 +76,11 @@ export function setResourceName(query: AzureMonitorQuery, resourceName: string |
azureMonitor: {
...query.azureMonitor,
resourceName: resourceName,
metricNamespace: undefined,
metricName: undefined,
aggregation: undefined,
timeGrain: '',
dimensionFilters: [],
},
};
}
@@ -75,6 +96,9 @@ export function setMetricNamespace(query: AzureMonitorQuery, metricNamespace: st
...query.azureMonitor,
metricNamespace: metricNamespace,
metricName: undefined,
aggregation: undefined,
timeGrain: '',
dimensionFilters: [],
},
};
}
@@ -89,6 +113,9 @@ export function setMetricName(query: AzureMonitorQuery, metricName: string | und
azureMonitor: {
...query.azureMonitor,
metricName: metricName,
aggregation: undefined,
timeGrain: '',
dimensionFilters: [],
},
};
}

View File

@@ -43,8 +43,8 @@ export const MarketTrendPanel: React.FC<CandlestickPanelProps> = ({
const info = useMemo(() => prepareCandlestickFields(data?.series, options, theme), [data, options, theme]);
const { renderers, tweakScale, tweakAxis } = useMemo(() => {
let tweakScale = (opts: ScaleProps) => opts;
let tweakAxis = (opts: AxisProps) => opts;
let tweakScale = (opts: ScaleProps, forField: Field) => opts;
let tweakAxis = (opts: AxisProps, forField: Field) => opts;
let doNothing = {
renderers: [],
@@ -97,8 +97,9 @@ export const MarketTrendPanel: React.FC<CandlestickPanelProps> = ({
theme: config.theme2,
});
tweakAxis = (opts: AxisProps) => {
if (opts.scaleKey === 'short') {
tweakAxis = (opts: AxisProps, forField: Field) => {
// we can't do forField === info.volume because of copies :(
if (forField.name === info.volume?.name) {
let filter = (u: uPlot, splits: number[]) => {
let _splits = [];
let max = u.series[volumeIdx].max as number;
@@ -122,8 +123,9 @@ export const MarketTrendPanel: React.FC<CandlestickPanelProps> = ({
return opts;
};
tweakScale = (opts: ScaleProps) => {
if (opts.scaleKey === 'short') {
tweakScale = (opts: ScaleProps, forField: Field) => {
// we can't do forField === info.volume because of copies :(
if (forField.name === info.volume?.name) {
opts.range = (u: uPlot, min: number, max: number) => [0, max * 7];
}

View File

@@ -1,6 +1,6 @@
import React, { useState, useLayoutEffect, useMemo, useRef } from 'react';
import { FieldConfigSource, ThresholdsConfig, getValueFormat } from '@grafana/data';
import { UPlotConfigBuilder, FIXED_UNIT } from '@grafana/ui';
import { FieldConfigSource, ThresholdsConfig, getValueFormat, FieldConfig } from '@grafana/data';
import { UPlotConfigBuilder, buildScaleKey, GraphFieldConfig } from '@grafana/ui';
import { ThresholdDragHandle } from './ThresholdDragHandle';
import uPlot from 'uplot';
@@ -42,7 +42,8 @@ export const ThresholdControlsPlugin: React.FC<ThresholdControlsPluginProps> = (
if (!thresholds) {
return null;
}
const scale = fieldConfig.defaults.unit ?? FIXED_UNIT;
const scale = buildScaleKey(fieldConfig as FieldConfig<GraphFieldConfig>);
const decimals = fieldConfig.defaults.decimals;
const handles = [];

View File

@@ -65,8 +65,8 @@ def get_steps(edition, is_downstream=False):
test_backend_step(edition=edition),
test_backend_integration_step(edition=edition),
test_frontend_step(),
postgres_integration_tests_step(),
mysql_integration_tests_step(),
postgres_integration_tests_step(edition=edition, ver_mode=ver_mode),
mysql_integration_tests_step(edition=edition, ver_mode=ver_mode),
build_backend_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
build_frontend_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
build_plugins_step(edition=edition, sign=True),
@@ -99,7 +99,7 @@ def get_steps(edition, is_downstream=False):
])
if include_enterprise2:
steps.extend([redis_integration_tests_step(), memcached_integration_tests_step()])
steps.extend([redis_integration_tests_step(edition=edition2, ver_mode=ver_mode), memcached_integration_tests_step(edition=edition2, ver_mode=ver_mode)])
steps.extend([
release_canary_npm_packages_step(edition),

View File

@@ -66,8 +66,8 @@ def pr_pipelines(edition):
ensure_cuetsified_step(),
]
integration_test_steps = [
postgres_integration_tests_step(),
mysql_integration_tests_step(),
postgres_integration_tests_step(edition=edition, ver_mode=ver_mode),
mysql_integration_tests_step(edition=edition, ver_mode=ver_mode),
]
if include_enterprise2:
@@ -98,8 +98,8 @@ def pr_pipelines(edition):
if include_enterprise2:
integration_test_steps.extend([
redis_integration_tests_step(),
memcached_integration_tests_step(),
redis_integration_tests_step(edition=edition2, ver_mode=ver_mode),
memcached_integration_tests_step(edition=edition, ver_mode=ver_mode),
])
build_steps.extend([
package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']),
@@ -119,6 +119,6 @@ def pr_pipelines(edition):
name='pr-build-e2e', edition=edition, trigger=trigger, services=[], steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode)
+ build_steps,
), pipeline(
name='pr-integration-tests', edition=edition, trigger=trigger, services=services, steps=[download_grabpl_step()] + integration_test_steps,
name='pr-integration-tests', edition=edition, trigger=trigger, services=services, steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + integration_test_steps,
),
]

View File

@@ -77,15 +77,15 @@ def release_npm_packages_step(edition, ver_mode):
}
def get_steps(edition, ver_mode):
build_steps = []
package_steps = []
windows_package_steps = []
publish_steps = []
should_publish = ver_mode in ('release', 'test-release',)
should_upload = should_publish or ver_mode in ('release-branch',)
include_enterprise2 = edition == 'enterprise'
tries = None
if should_publish:
tries = 5
steps = [
lint_drone_step(),
build_steps = [
codespell_step(),
shellcheck_step(),
lint_backend_step(edition=edition),
@@ -93,8 +93,8 @@ def get_steps(edition, ver_mode):
test_backend_step(edition=edition),
test_backend_integration_step(edition=edition),
test_frontend_step(),
postgres_integration_tests_step(),
mysql_integration_tests_step(),
postgres_integration_tests_step(edition=edition, ver_mode=ver_mode),
mysql_integration_tests_step(edition=edition, ver_mode=ver_mode),
build_backend_step(edition=edition, ver_mode=ver_mode),
build_frontend_step(edition=edition, ver_mode=ver_mode),
build_plugins_step(edition=edition, sign=True),
@@ -102,9 +102,9 @@ def get_steps(edition, ver_mode):
ensure_cuetsified_step(),
]
edition2 = 'enterprise2'
if include_enterprise2:
edition2 = 'enterprise2'
steps.extend([
build_steps.extend([
lint_backend_step(edition=edition2),
test_backend_step(edition=edition2),
test_backend_integration_step(edition=edition2),
@@ -112,7 +112,7 @@ def get_steps(edition, ver_mode):
])
# Insert remaining steps
steps.extend([
build_steps.extend([
package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2),
e2e_tests_server_step(edition=edition),
e2e_tests_step(edition=edition, tries=3),
@@ -123,26 +123,26 @@ def get_steps(edition, ver_mode):
build_storybook = build_storybook_step(edition=edition, ver_mode=ver_mode)
if build_storybook:
steps.append(build_storybook)
build_steps.append(build_storybook)
if include_enterprise2:
steps.extend([redis_integration_tests_step(), memcached_integration_tests_step()])
build_steps.extend([redis_integration_tests_step(edition=edition2, ver_mode=ver_mode), memcached_integration_tests_step(edition=edition2, ver_mode=ver_mode)])
if should_upload:
steps.append(upload_cdn_step(edition=edition))
steps.append(upload_packages_step(edition=edition, ver_mode=ver_mode))
publish_steps.append(upload_cdn_step(edition=edition))
publish_steps.append(upload_packages_step(edition=edition, ver_mode=ver_mode))
if should_publish:
publish_step = publish_storybook_step(edition=edition, ver_mode=ver_mode)
release_npm_step = release_npm_packages_step(edition=edition, ver_mode=ver_mode)
if publish_step:
steps.append(publish_step)
publish_steps.append(publish_step)
if release_npm_step:
steps.append(release_npm_step)
windows_steps = get_windows_steps(edition=edition, ver_mode=ver_mode)
publish_steps.append(release_npm_step)
windows_package_steps = get_windows_steps(edition=edition, ver_mode=ver_mode)
if include_enterprise2:
edition2 = 'enterprise2'
steps.extend([
publish_steps.extend([
package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']),
e2e_tests_server_step(edition=edition2, port=3002),
e2e_tests_step(edition=edition2, port=3002, tries=3),
@@ -151,22 +151,23 @@ def get_steps(edition, ver_mode):
if should_upload:
step = upload_packages_step(edition=edition2, ver_mode=ver_mode)
if step:
steps.append(step)
publish_steps.append(step)
return steps, windows_steps
return build_steps, package_steps, windows_package_steps, publish_steps
def get_oss_pipelines(trigger, ver_mode):
edition = 'oss'
services = integration_test_services(edition=edition)
steps, windows_steps = get_steps(edition=edition, ver_mode=ver_mode)
build_steps, package_steps, windows_package_steps, publish_steps = get_steps(edition=edition, ver_mode=ver_mode)
return [
pipeline(
name='oss-build-{}'.format(ver_mode), edition=edition, trigger=trigger, services=services,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) +
build_steps + package_steps + publish_steps,
),
pipeline(
name='oss-windows-{}'.format(ver_mode), edition=edition, trigger=trigger,
steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps,
steps=initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_package_steps,
platform='windows', depends_on=['oss-build-{}'.format(ver_mode)],
),
]
@@ -174,15 +175,16 @@ def get_oss_pipelines(trigger, ver_mode):
def get_enterprise_pipelines(trigger, ver_mode):
edition = 'enterprise'
services = integration_test_services(edition=edition)
steps, windows_steps = get_steps(edition=edition, ver_mode=ver_mode)
build_steps, package_steps, windows_package_steps, publish_steps = get_steps(edition=edition, ver_mode=ver_mode)
return [
pipeline(
name='enterprise-build-{}'.format(ver_mode), edition=edition, trigger=trigger, services=services,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) +
build_steps + package_steps + publish_steps,
),
pipeline(
name='enterprise-windows-{}'.format(ver_mode), edition=edition, trigger=trigger,
steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps,
steps=initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_package_steps,
platform='windows', depends_on=['enterprise-build-{}'.format(ver_mode)],
),
]

View File

@@ -1,6 +1,6 @@
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token')
grabpl_version = '2.6.0'
grabpl_version = '2.6.2'
build_image = 'grafana/build-container:1.4.5'
publish_image = 'grafana/grafana-ci-deploy:1.3.1'
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
@@ -11,6 +11,7 @@ windows_image = 'mcr.microsoft.com/windows:1809'
wix_image = 'grafana/ci-wix:0.1.1'
test_release_ver = 'v7.3.0-test'
def slack_step(channel):
return {
'name': 'slack',
@@ -22,6 +23,7 @@ def slack_step(channel):
},
}
def initialize_step(edition, platform, ver_mode, is_downstream=False, install_deps=True):
if platform == 'windows':
return [
@@ -53,13 +55,7 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
build_no = '$${SOURCE_BUILD_NUMBER}'
args = '--build-id {}'.format(build_no)
identify_runner_step = {
'name': 'identify-runner',
'image': alpine_image,
'commands': [
'echo $DRONE_RUNNER_NAME',
],
}
identify_runner = identify_runner_step(platform)
if install_deps:
common_cmds.extend([
@@ -80,41 +76,30 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
source_commit = ' $${SOURCE_COMMIT}'
committish = '${DRONE_COMMIT}'
steps = [
identify_runner_step,
{
'name': 'clone',
'image': build_image,
'environment': {
'GITHUB_TOKEN': from_secret(github_token),
},
'commands': [
'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"',
'cd grafana-enterprise',
'git checkout {}'.format(committish),
],
},
identify_runner,
clone_enterprise(committish),
{
'name': 'initialize',
'image': build_image,
'depends_on': [
'grabpl',
'clone-enterprise',
],
'commands': [
'mv bin/grabpl /tmp/',
'rmdir bin',
'mv grafana-enterprise /tmp/',
'/tmp/grabpl init-enterprise /tmp/grafana-enterprise{}'.format(source_commit),
'mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json',
'mkdir bin',
'mv /tmp/grabpl bin/'
] + common_cmds,
'mv bin/grabpl /tmp/',
'rmdir bin',
'mv grafana-enterprise /tmp/',
'/tmp/grabpl init-enterprise /tmp/grafana-enterprise{}'.format(source_commit),
'mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json',
'mkdir bin',
'mv /tmp/grabpl bin/'
] + common_cmds,
},
]
return steps
steps = [
identify_runner_step,
identify_runner,
{
'name': 'initialize',
'image': build_image,
@@ -124,6 +109,41 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
return steps
def identify_runner_step(platform):
if platform == 'linux':
return {
'name': 'identify-runner',
'image': alpine_image,
'commands': [
'echo $DRONE_RUNNER_NAME',
],
}
else:
return {
'name': 'identify-runner',
'image': windows_image,
'commands': [
'echo $env:DRONE_RUNNER_NAME',
],
}
def clone_enterprise(committish):
return {
'name': 'clone-enterprise',
'image': build_image,
'environment': {
'GITHUB_TOKEN': from_secret(github_token),
},
'commands': [
'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"',
'cd grafana-enterprise',
'git checkout {}'.format(committish),
],
}
def download_grabpl_step():
return {
'name': 'grabpl',
@@ -137,6 +157,7 @@ def download_grabpl_step():
]
}
def lint_drone_step():
return {
'name': 'lint-drone',
@@ -149,6 +170,7 @@ def lint_drone_step():
],
}
def enterprise_downstream_step(edition):
if edition in ('enterprise', 'enterprise2'):
return None
@@ -169,6 +191,7 @@ def enterprise_downstream_step(edition):
},
}
def lint_backend_step(edition):
return {
'name': 'lint-backend' + enterprise2_suffix(edition),
@@ -186,6 +209,7 @@ def lint_backend_step(edition):
],
}
def benchmark_ldap_step():
return {
'name': 'benchmark-ldap',
@@ -194,7 +218,7 @@ def benchmark_ldap_step():
'initialize',
],
'environment': {
'LDAP_HOSTNAME': 'ldap',
'LDAP_HOSTNAME': 'ldap',
},
'commands': [
'dockerize -wait tcp://ldap:389 -timeout 120s',
@@ -202,6 +226,7 @@ def benchmark_ldap_step():
],
}
def build_storybook_step(edition, ver_mode):
if edition in ('enterprise', 'enterprise2') and ver_mode in ('release', 'test-release'):
return None
@@ -222,6 +247,7 @@ def build_storybook_step(edition, ver_mode):
],
}
def publish_storybook_step(edition, ver_mode):
if edition in ('enterprise', 'enterprise2'):
return None
@@ -233,16 +259,17 @@ def publish_storybook_step(edition, ver_mode):
else:
commands = []
if ver_mode == 'release':
channels = ['latest', '${DRONE_TAG}',]
channels = ['latest', '${DRONE_TAG}', ]
else:
channels = ['canary',]
channels = ['canary', ]
commands.extend([
'printenv GCP_KEY | base64 -d > /tmp/gcpkey.json',
'gcloud auth activate-service-account --key-file=/tmp/gcpkey.json',
] + [
'gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/{}'.format(c)
for c in channels
])
'printenv GCP_KEY | base64 -d > /tmp/gcpkey.json',
'gcloud auth activate-service-account --key-file=/tmp/gcpkey.json',
] + [
'gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/{}'.format(
c)
for c in channels
])
return {
'name': 'publish-storybook',
@@ -257,6 +284,7 @@ def publish_storybook_step(edition, ver_mode):
'commands': commands,
}
def upload_cdn_step(edition):
return {
'name': 'upload-cdn-assets' + enterprise2_suffix(edition),
@@ -268,10 +296,11 @@ def upload_cdn_step(edition):
'GCP_GRAFANA_UPLOAD_KEY': from_secret('gcp_key'),
},
'commands': [
'./bin/grabpl upload-cdn --edition {} --bucket "grafana-static-assets"'.format(edition),
'./bin/grabpl upload-cdn --edition {} --bucket "grafana-static-assets"'.format(edition),
],
}
def build_backend_step(edition, ver_mode, variants=None, is_downstream=False):
variants_str = ''
if variants:
@@ -318,6 +347,7 @@ def build_backend_step(edition, ver_mode, variants=None, is_downstream=False):
'commands': cmds,
}
def build_frontend_step(edition, ver_mode, is_downstream=False):
if not is_downstream:
build_no = '${DRONE_BUILD_NUMBER}'
@@ -328,17 +358,17 @@ def build_frontend_step(edition, ver_mode, is_downstream=False):
if ver_mode == 'release':
cmds = [
'./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps ' + \
'--edition {} --no-pull-enterprise ${{DRONE_TAG}}'.format(edition),
'--edition {} --no-pull-enterprise ${{DRONE_TAG}}'.format(edition),
]
elif ver_mode == 'test-release':
cmds = [
'./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps ' + \
'--edition {} --no-pull-enterprise {}'.format(edition, test_release_ver),
]
'--edition {} --no-pull-enterprise {}'.format(edition, test_release_ver),
]
else:
cmds = [
'./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition {} '.format(edition) + \
'--build-id {} --no-pull-enterprise'.format(build_no),
'--build-id {} --no-pull-enterprise'.format(build_no),
]
return {
@@ -350,6 +380,7 @@ def build_frontend_step(edition, ver_mode, is_downstream=False):
'commands': cmds,
}
def build_frontend_docs_step(edition):
return {
'name': 'build-frontend-docs',
@@ -362,6 +393,7 @@ def build_frontend_docs_step(edition):
]
}
def build_plugins_step(edition, sign=False):
if sign:
env = {
@@ -384,6 +416,7 @@ def build_plugins_step(edition, sign=False):
],
}
def test_backend_step(edition):
return {
'name': 'test-backend' + enterprise2_suffix(edition),
@@ -396,6 +429,7 @@ def test_backend_step(edition):
],
}
def test_backend_integration_step(edition):
return {
'name': 'test-backend-integration' + enterprise2_suffix(edition),
@@ -408,6 +442,7 @@ def test_backend_integration_step(edition):
],
}
def test_frontend_step():
return {
'name': 'test-frontend',
@@ -423,6 +458,7 @@ def test_frontend_step():
],
}
def lint_frontend_step():
return {
'name': 'lint-frontend',
@@ -440,6 +476,7 @@ def lint_frontend_step():
],
}
def test_a11y_frontend_step(ver_mode, edition, port=3001):
commands = [
'yarn wait-on http://$HOST:$PORT',
@@ -459,9 +496,9 @@ def test_a11y_frontend_step(ver_mode, edition, port=3001):
'name': 'test-a11y-frontend' + enterprise2_suffix(edition),
'image': 'hugohaggmark/docker-puppeteer',
'depends_on': [
'end-to-end-tests-server' + enterprise2_suffix(edition),
'end-to-end-tests-server' + enterprise2_suffix(edition),
],
'environment': {
'environment': {
'GRAFANA_MISC_STATS_API_KEY': from_secret('grafana_misc_stats_api_key'),
'HOST': 'end-to-end-tests-server' + enterprise2_suffix(edition),
'PORT': port,
@@ -470,6 +507,7 @@ def test_a11y_frontend_step(ver_mode, edition, port=3001):
'commands': commands,
}
def frontend_metrics_step(edition):
if edition in ('enterprise', 'enterprise2'):
return None
@@ -489,6 +527,7 @@ def frontend_metrics_step(edition):
],
}
def codespell_step():
return {
'name': 'codespell',
@@ -504,6 +543,7 @@ def codespell_step():
],
}
def shellcheck_step():
return {
'name': 'shellcheck',
@@ -516,6 +556,7 @@ def shellcheck_step():
],
}
def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is_downstream=False):
deps = [
'build-plugins',
@@ -552,16 +593,16 @@ def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is
if ver_mode == 'release':
cmds = [
'{}./bin/grabpl package --jobs 8 --edition {} '.format(test_args, edition) + \
'--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} ${{DRONE_TAG}}'.format(
sign_args
),
'--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} ${{DRONE_TAG}}'.format(
sign_args
),
]
elif ver_mode == 'test-release':
cmds = [
'{}./bin/grabpl package --jobs 8 --edition {} '.format(test_args, edition) + \
'--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} {}'.format(
sign_args, test_release_ver,
),
'--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} {}'.format(
sign_args, test_release_ver,
),
]
else:
if not is_downstream:
@@ -570,7 +611,7 @@ def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is
build_no = '$${SOURCE_BUILD_NUMBER}'
cmds = [
'{}./bin/grabpl package --jobs 8 --edition {} '.format(test_args, edition) + \
'--build-id {} --no-pull-enterprise{}{}'.format(build_no, variants_str, sign_args),
'--build-id {} --no-pull-enterprise{}{}'.format(build_no, variants_str, sign_args),
]
return {
@@ -581,6 +622,7 @@ def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is
'commands': cmds,
}
def e2e_tests_server_step(edition, port=3001):
package_file_pfx = ''
if edition == 'enterprise2':
@@ -608,6 +650,7 @@ def e2e_tests_server_step(edition, port=3001):
],
}
def e2e_tests_step(edition, port=3001, tries=None):
cmd = './bin/grabpl e2e-tests --port {}'.format(port)
if tries:
@@ -629,6 +672,7 @@ def e2e_tests_step(edition, port=3001, tries=None):
],
}
def build_docs_website_step():
return {
'name': 'build-docs-website',
@@ -644,6 +688,7 @@ def build_docs_website_step():
],
}
def copy_packages_for_docker_step():
return {
'name': 'copy-packages-for-docker',
@@ -657,6 +702,7 @@ def copy_packages_for_docker_step():
],
}
def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publish=False):
if ver_mode == 'test-release':
publish = False
@@ -683,13 +729,17 @@ def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publis
'settings': settings,
}
def postgres_integration_tests_step():
def postgres_integration_tests_step(edition, ver_mode):
deps = []
if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'):
deps.extend(['initialize'])
else:
deps.extend(['grabpl'])
return {
'name': 'postgres-integration-tests',
'image': build_image,
'depends_on': [
'grabpl',
],
'depends_on': deps,
'environment': {
'PGPASSWORD': 'grafanatest',
'GRAFANA_TEST_DB': 'postgres',
@@ -700,20 +750,24 @@ def postgres_integration_tests_step():
'apt-get install -yq postgresql-client',
'dockerize -wait tcp://postgres:5432 -timeout 120s',
'psql -p 5432 -h postgres -U grafanatest -d grafanatest -f ' +
'devenv/docker/blocks/postgres_tests/setup.sql',
'devenv/docker/blocks/postgres_tests/setup.sql',
# Make sure that we don't use cached results for another database
'go clean -testcache',
'./bin/grabpl integration-tests --database postgres',
],
}
def mysql_integration_tests_step():
def mysql_integration_tests_step(edition, ver_mode):
deps = []
if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'):
deps.extend(['initialize'])
else:
deps.extend(['grabpl'])
return {
'name': 'mysql-integration-tests',
'image': build_image,
'depends_on': [
'grabpl',
],
'depends_on': deps,
'environment': {
'GRAFANA_TEST_DB': 'mysql',
'MYSQL_HOST': 'mysql',
@@ -729,13 +783,17 @@ def mysql_integration_tests_step():
],
}
def redis_integration_tests_step():
def redis_integration_tests_step(edition, ver_mode):
deps = []
if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'):
deps.extend(['initialize'])
else:
deps.extend(['grabpl'])
return {
'name': 'redis-integration-tests',
'image': build_image,
'depends_on': [
'grabpl',
],
'depends_on': deps,
'environment': {
'REDIS_URL': 'redis://redis:6379/0',
},
@@ -745,13 +803,17 @@ def redis_integration_tests_step():
],
}
def memcached_integration_tests_step():
def memcached_integration_tests_step(edition, ver_mode):
deps = []
if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'):
deps.extend(['initialize'])
else:
deps.extend(['grabpl'])
return {
'name': 'memcached-integration-tests',
'image': build_image,
'depends_on': [
'grabpl',
],
'depends_on': deps,
'environment': {
'MEMCACHED_HOSTS': 'memcached:11211',
},

View File

@@ -2329,9 +2329,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource"
dependencies:
"@grafana/data": 8.3.0-pre
"@grafana/toolkit": 8.3.0-pre
"@grafana/ui": 8.3.0-pre
"@grafana/data": 8.3.0-beta.1
"@grafana/toolkit": 8.3.0-beta.1
"@grafana/ui": 8.3.0-beta.1
"@types/jest": 26.0.15
"@types/react": 17.0.30
jquery: 3.5.1
@@ -2369,12 +2369,12 @@ __metadata:
languageName: node
linkType: hard
"@grafana/data@8.3.0-pre, @grafana/data@workspace:*, @grafana/data@workspace:packages/grafana-data":
"@grafana/data@8.3.0-beta.1, @grafana/data@workspace:*, @grafana/data@workspace:packages/grafana-data":
version: 0.0.0-use.local
resolution: "@grafana/data@workspace:packages/grafana-data"
dependencies:
"@braintree/sanitize-url": 5.0.2
"@grafana/schema": 8.3.0-pre
"@grafana/schema": 8.3.0-beta.1
"@grafana/tsconfig": ^1.0.0-rc1
"@rollup/plugin-commonjs": 21.0.1
"@rollup/plugin-json": 4.1.0
@@ -2429,7 +2429,7 @@ __metadata:
languageName: unknown
linkType: soft
"@grafana/e2e-selectors@8.3.0-pre, @grafana/e2e-selectors@workspace:*, @grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors":
"@grafana/e2e-selectors@8.3.0-beta.1, @grafana/e2e-selectors@workspace:*, @grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors":
version: 0.0.0-use.local
resolution: "@grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors"
dependencies:
@@ -2461,7 +2461,7 @@ __metadata:
"@babel/core": 7.14.6
"@babel/preset-env": 7.14.7
"@cypress/webpack-preprocessor": 5.9.1
"@grafana/e2e-selectors": 8.3.0-pre
"@grafana/e2e-selectors": 8.3.0-beta.1
"@grafana/tsconfig": ^1.0.0-rc1
"@mochajs/json-file-reporter": ^1.2.0
"@rollup/plugin-commonjs": 21.0.1
@@ -2519,10 +2519,10 @@ __metadata:
resolution: "@grafana/runtime@workspace:packages/grafana-runtime"
dependencies:
"@emotion/css": 11.1.3
"@grafana/data": 8.3.0-pre
"@grafana/e2e-selectors": 8.3.0-pre
"@grafana/data": 8.3.0-beta.1
"@grafana/e2e-selectors": 8.3.0-beta.1
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/ui": 8.3.0-pre
"@grafana/ui": 8.3.0-beta.1
"@rollup/plugin-commonjs": 21.0.1
"@rollup/plugin-node-resolve": 13.0.6
"@sentry/browser": 5.25.0
@@ -2554,7 +2554,7 @@ __metadata:
languageName: unknown
linkType: soft
"@grafana/schema@8.3.0-pre, @grafana/schema@workspace:*, @grafana/schema@workspace:packages/grafana-schema":
"@grafana/schema@8.3.0-beta.1, @grafana/schema@workspace:*, @grafana/schema@workspace:packages/grafana-schema":
version: 0.0.0-use.local
resolution: "@grafana/schema@workspace:packages/grafana-schema"
dependencies:
@@ -2604,16 +2604,16 @@ __metadata:
languageName: node
linkType: hard
"@grafana/toolkit@8.3.0-pre, @grafana/toolkit@workspace:*, @grafana/toolkit@workspace:packages/grafana-toolkit":
"@grafana/toolkit@8.3.0-beta.1, @grafana/toolkit@workspace:*, @grafana/toolkit@workspace:packages/grafana-toolkit":
version: 0.0.0-use.local
resolution: "@grafana/toolkit@workspace:packages/grafana-toolkit"
dependencies:
"@babel/core": 7.13.14
"@babel/preset-env": 7.13.12
"@grafana/data": 8.3.0-pre
"@grafana/data": 8.3.0-beta.1
"@grafana/eslint-config": 2.5.1
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/ui": 8.3.0-pre
"@grafana/ui": 8.3.0-beta.1
"@jest/core": 26.6.3
"@rushstack/eslint-patch": 1.0.6
"@types/command-exists": ^1.2.0
@@ -2697,7 +2697,7 @@ __metadata:
languageName: node
linkType: hard
"@grafana/ui@8.3.0-pre, @grafana/ui@workspace:*, @grafana/ui@workspace:packages/grafana-ui":
"@grafana/ui@8.3.0-beta.1, @grafana/ui@workspace:*, @grafana/ui@workspace:packages/grafana-ui":
version: 0.0.0-use.local
resolution: "@grafana/ui@workspace:packages/grafana-ui"
dependencies:
@@ -2705,9 +2705,9 @@ __metadata:
"@emotion/css": 11.1.3
"@emotion/react": 11.1.5
"@grafana/aws-sdk": 0.0.3
"@grafana/data": 8.3.0-pre
"@grafana/e2e-selectors": 8.3.0-pre
"@grafana/schema": 8.3.0-pre
"@grafana/data": 8.3.0-beta.1
"@grafana/e2e-selectors": 8.3.0-beta.1
"@grafana/schema": 8.3.0-beta.1
"@grafana/slate-react": 0.22.10-grafana
"@grafana/tsconfig": ^1.0.0-rc1
"@mdx-js/react": 1.6.22
@@ -2920,9 +2920,9 @@ __metadata:
dependencies:
"@emotion/css": 11.1.3
"@emotion/react": 11.1.5
"@grafana/data": 8.3.0-pre
"@grafana/data": 8.3.0-beta.1
"@grafana/tsconfig": ^1.0.0-rc1
"@grafana/ui": 8.3.0-pre
"@grafana/ui": 8.3.0-beta.1
"@types/classnames": ^2.2.7
"@types/deep-freeze": ^0.1.1
"@types/grafana__slate-react": "npm:@types/slate-react@0.22.5"