Skip to content

Commit e216547

Browse files
authored
Merge pull request #373 from grafana/dev
Merge dev to main for 1.0.22 release
2 parents d02c6aa + f3c5558 commit e216547

22 files changed

+1617
-156
lines changed

.drone.yml

Lines changed: 118 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,6 @@ steps:
4747
ref:
4848
- refs/tags/v*.*.*
4949

50-
- name: Publish Plugin to Github (release)
51-
image: plugins/github-release
52-
settings:
53-
api_key:
54-
from_secret: gh_token
55-
files: grafana-plugin/ci/dist/grafana-oncall-app-${DRONE_TAG}.zip
56-
title: ${DRONE_TAG}
57-
depends_on:
58-
- Sign and Package Plugin
59-
when:
60-
ref:
61-
- refs/tags/v*.*.*
62-
63-
- name: Publish Plugin to grafana.com (release)
64-
image: curlimages/curl:7.73.0
65-
environment:
66-
GRAFANA_API_KEY:
67-
from_secret: gcom_plugin_publisher_api_key
68-
commands:
69-
- "curl -f -s -H \"Authorization: Bearer $${GRAFANA_API_KEY}\" -d \"download[any][url]=https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip\" -d \"download[any][md5]=$$(curl -sL https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip | md5sum | cut -d' ' -f1)\" -d url=https://github.com/grafana/oncall/grafana-plugin https://grafana.com/api/plugins"
70-
depends_on:
71-
- Publish Plugin to GCS (release)
72-
- Publish Plugin to Github (release)
73-
when:
74-
ref:
75-
- refs/tags/v*.*.*
76-
7750
- name: Lint Backend
7851
image: python:3.9
7952
environment:
@@ -142,7 +115,6 @@ steps:
142115
when:
143116
ref:
144117
- refs/heads/dev
145-
- refs/tags/v*.*.*
146118

147119
# Services for Unit Test Backend
148120
services:
@@ -170,6 +142,124 @@ trigger:
170142
- refs/heads/dev
171143
- refs/tags/v*.*.*
172144

145+
---
146+
kind: pipeline
147+
type: docker
148+
name: OSS Release
149+
150+
steps:
151+
- name: Check Promote
152+
image: alpine
153+
commands:
154+
- if [ -z "$DRONE_DEPLOY_TO" ]; then echo "Missing DRONE_DEPLOY_TO (Target)"; exit 1; fi
155+
- if [ -z "$DRONE_TAG" ]; then echo "Missing DRONE_TAG"; exit 1; fi
156+
- echo Promoting $DRONE_TAG to $DRONE_DEPLOY_TO
157+
158+
- name: Build Plugin
159+
image: node:14.6.0-stretch
160+
commands:
161+
- apt-get update
162+
- apt-get --assume-yes install jq
163+
- cd grafana-plugin/
164+
- if [ -z "$DRONE_TAG" ]; then echo "No tag, not modifying version"; else jq '.version="${DRONE_TAG}"' package.json > package.new && mv package.new package.json && jq '.version' package.json; fi
165+
- yarn --network-timeout 500000
166+
- yarn build
167+
- ls ./
168+
depends_on:
169+
- Check Promote
170+
when:
171+
event:
172+
- promote
173+
target:
174+
- oss
175+
ref:
176+
- refs/tags/v*.*.*
177+
178+
- name: Sign and Package Plugin
179+
image: node:14.6.0-stretch
180+
environment:
181+
GRAFANA_API_KEY:
182+
from_secret: gcom_plugin_publisher_api_key
183+
depends_on:
184+
- Build Plugin
185+
commands:
186+
- apt-get update
187+
- apt-get install zip
188+
- cd grafana-plugin
189+
- yarn sign
190+
- yarn ci-build:finish
191+
- yarn ci-package
192+
- cd ci/dist
193+
- zip -r grafana-oncall-app.zip ./grafana-oncall-app
194+
- if [ -z "$DRONE_TAG" ]; then echo "No tag, skipping archive"; else cp grafana-oncall-app.zip grafana-oncall-app-${DRONE_TAG}.zip; fi
195+
196+
- name: Publish Plugin to Github (release)
197+
image: plugins/github-release
198+
settings:
199+
api_key:
200+
from_secret: gh_token
201+
files: grafana-plugin/ci/dist/grafana-oncall-app-${DRONE_TAG}.zip
202+
title: ${DRONE_TAG}
203+
depends_on:
204+
- Sign and Package Plugin
205+
206+
- name: Publish Plugin to grafana.com (release)
207+
image: curlimages/curl:7.73.0
208+
environment:
209+
GRAFANA_API_KEY:
210+
from_secret: gcom_plugin_publisher_api_key
211+
commands:
212+
- "curl -f -s -H \"Authorization: Bearer $${GRAFANA_API_KEY}\" -d \"download[any][url]=https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip\" -d \"download[any][md5]=$$(curl -sL https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip | md5sum | cut -d' ' -f1)\" -d url=https://github.com/grafana/oncall/grafana-plugin https://grafana.com/api/plugins"
213+
depends_on:
214+
- Publish Plugin to Github (release)
215+
216+
- name: Image Tag
217+
image: alpine
218+
commands:
219+
- apk add --no-cache bash git sed
220+
- git fetch origin --tags
221+
- chmod +x ./tools/image-tag.sh
222+
- echo $(./tools/image-tag.sh)
223+
- echo $(./tools/image-tag.sh) > .tags
224+
- if [ -z "$DRONE_TAG" ]; then echo "No tag, not modifying version"; else sed "0,/VERSION.*/ s/VERSION.*/VERSION = \"${DRONE_TAG}\"/g" engine/settings/base.py > engine/settings/base.temp && mv engine/settings/base.temp engine/settings/base.py; fi
225+
- cat engine/settings/base.py | grep VERSION | head -1
226+
depends_on:
227+
- Check Promote
228+
when:
229+
event:
230+
- promote
231+
target:
232+
- oss
233+
ref:
234+
- refs/tags/v*.*.*
235+
236+
- name: Build and Push Engine Docker Image Backend to Dockerhub
237+
image: plugins/docker
238+
settings:
239+
repo: grafana/oncall
240+
dockerfile: engine/Dockerfile
241+
context: engine/
242+
password:
243+
from_secret: docker_password
244+
username:
245+
from_secret: docker_username
246+
depends_on:
247+
- Image Tag
248+
249+
- name: Unrecognized Promote Target
250+
image: alpine
251+
commands:
252+
- echo $DRONE_DEPLOY_TO is not a recognized promote target!
253+
- exit 1
254+
when:
255+
target:
256+
exclude:
257+
- oss
258+
259+
trigger:
260+
event:
261+
- promote
262+
173263
---
174264
# Secret for pulling docker images.
175265
kind: secret

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,36 @@ jobs:
6565
cd engine/
6666
pip install -r requirements.txt
6767
./wait_for_test_mysql_start.sh && pytest --ds=settings.ci-test -x
68+
69+
unit-test-backend-postgresql:
70+
runs-on: ubuntu-latest
71+
container: python:3.9
72+
env:
73+
DB_BACKEND: postgresql
74+
DJANGO_SETTINGS_MODULE: settings.ci-test
75+
SLACK_CLIENT_OAUTH_ID: 1
76+
services:
77+
rabbit_test:
78+
image: rabbitmq:3.7.19
79+
env:
80+
RABBITMQ_DEFAULT_USER: rabbitmq
81+
RABBITMQ_DEFAULT_PASS: rabbitmq
82+
postgresql_test:
83+
image: postgres:14.4
84+
env:
85+
POSTGRES_DB: oncall_local_dev
86+
POSTGRES_PASSWORD: local_dev_pwd
87+
# Set health checks to wait until postgres has started
88+
options: >-
89+
--health-cmd pg_isready
90+
--health-interval 10s
91+
--health-timeout 5s
92+
--health-retries 5
93+
steps:
94+
- uses: actions/checkout@v2
95+
- name: Unit Test Backend
96+
run: |
97+
cd engine/
98+
pip install -r requirements.txt
99+
pytest --ds=settings.ci-test -x
100+

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Change Log
22

3+
## v1.0.22 (2022-08-16)
4+
- Make STATIC_URL configurable from environment variable
5+
36
## v1.0.21 (2022-08-12)
47
- Bug fixes
5-
-
8+
69
## v1.0.19 (2022-08-10)
710
- Bug fixes
811

DEVELOPER.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
docker-compose -f docker-compose-developer.yml up -d
3232
```
3333

34+
NOTE: to use a PostgreSQL db backend, use the `docker-compose-developer-pg.yml` file instead.
35+
3436
2. Prepare a python environment:
3537
```bash
3638
# Create and activate the virtual environment
@@ -45,6 +47,9 @@ pip install -U pip wheel
4547
# Copy and check .env file.
4648
cp .env.example .env
4749

50+
# NOTE: if you want to use the PostgreSQL db backend add DB_BACKEND=postgresql to your .env file;
51+
# currently allowed backend values are `mysql` (default) and `postgresql`
52+
4853
# Apply .env to current terminal.
4954
# For PyCharm it's better to use https://plugins.jetbrains.com/plugin/7861-envfile/
5055
export $(grep -v '^#' .env | xargs -0)

docker-compose-developer-pg.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
version: '3.2'
2+
3+
services:
4+
5+
postgres:
6+
image: postgres:14.4
7+
platform: linux/x86_64
8+
mem_limit: 500m
9+
cpus: 0.5
10+
restart: always
11+
ports:
12+
- 5432:5432
13+
environment:
14+
POSTGRES_DB: oncall_local_dev
15+
POSTGRES_PASSWORD: empty
16+
POSTGRES_INITDB_ARGS: '--encoding=UTF-8'
17+
18+
redis:
19+
image: redis
20+
mem_limit: 100m
21+
cpus: 0.1
22+
restart: always
23+
ports:
24+
- 6379:6379
25+
26+
rabbit:
27+
image: "rabbitmq:3.7.15-management"
28+
mem_limit: 1000m
29+
cpus: 0.5
30+
environment:
31+
RABBITMQ_DEFAULT_USER: "rabbitmq"
32+
RABBITMQ_DEFAULT_PASS: "rabbitmq"
33+
RABBITMQ_DEFAULT_VHOST: "/"
34+
ports:
35+
- 15672:15672
36+
- 5672:5672
37+
38+
mysql-to-create-grafana-db:
39+
image: mysql:5.7
40+
platform: linux/x86_64
41+
mem_limit: 500m
42+
cpus: 0.5
43+
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
44+
restart: always
45+
ports:
46+
- 3306:3306
47+
environment:
48+
MYSQL_ROOT_PASSWORD: empty
49+
MYSQL_DATABASE: grafana
50+
healthcheck:
51+
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
52+
timeout: 20s
53+
retries: 10
54+
55+
grafana:
56+
image: "grafana/grafana:9.0.0-beta3"
57+
restart: always
58+
mem_limit: 500m
59+
cpus: 0.5
60+
environment:
61+
GF_DATABASE_TYPE: mysql
62+
GF_DATABASE_HOST: mysql
63+
GF_DATABASE_USER: root
64+
GF_DATABASE_PASSWORD: empty
65+
GF_SECURITY_ADMIN_USER: oncall
66+
GF_SECURITY_ADMIN_PASSWORD: oncall
67+
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-oncall-app
68+
volumes:
69+
- ./grafana-plugin:/var/lib/grafana/plugins/grafana-plugin
70+
ports:
71+
- 3000:3000
72+
depends_on:
73+
mysql-to-create-grafana-db:
74+
condition: service_healthy

docker-compose-developer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ services:
6565
ports:
6666
- 3000:3000
6767
depends_on:
68-
mysql:
68+
mysql-to-create-grafana-db:
6969
condition: service_healthy

docs/sources/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ For more information on Escalation Chains and more ways to customize them, refer
8383
In order for Grafana OnCall to notify you of an alert, you must configure how you want to be notified. Personal notification policies, chatops integrations, and on-call schedules allow you to automate how users are notified of alerts.
8484

8585
### Configure personal notification policies
86-
Personal notification policies determine how a user is notified for a certain type of alert. Administrators can configure how users receive notification for certain types of alerts. For more information on personal notification policies, refer to [Manage users and teams for Grafana OnCall]({{< relref "configure-user-settings/" >}})
86+
Personal notification policies determine how a user is notified for a certain type of alert. Get notified by SMS, phone call, or Slack mentions. Administrators can configure how users receive notification for certain types of alerts. For more information on personal notification policies, refer to [Manage users and teams for Grafana OnCall]({{< relref "configure-user-settings/" >}})
8787

8888
To configure users personal notification policies:
8989

0 commit comments

Comments
 (0)