Commit graph

413 commits

Author SHA1 Message Date
Matias Bordese
4bc3ed17a8 Make interval check more explicit 2022-11-02 16:12:16 -03:00
Matias Bordese
241283959a Enable daily/by-day shifts option for web schedules 2022-11-02 16:12:16 -03:00
Matvey Kukuy
85d94d342e
Readme about how to add Integrations and Zabbix Integration (#653)
* Readme and zabbix

* Typos

* Linking
2022-11-02 22:58:47 +08:00
Vadim Stepanov
035584f17e
Enable email backend by default (#740)
* enable email backend by default, catch empty EMAIL_HOST

* fix tests

* fix tests

* fix tests
2022-11-01 13:48:36 +00:00
Ildar Iskhakov
001a760be7
Update manual_incident.py 2022-11-01 17:23:29 +08:00
Innokentii Konstantinov
4e8982cc81
Add management command to manually verify phone numbers (#743)
* Add cmd to manully verify phone numbers

* Rework verify_phone command
2022-11-01 16:38:04 +08:00
Matias Bordese
64570cc9fd Update schedules endpoint to filter by numeric type 2022-10-31 11:08:33 -03:00
Yulia Shanyrova
6b65fc7278 Merge branch 'dev' into 637-telegram-installation-redesign 2022-10-31 12:21:40 +01:00
Joey Orlando
5a4c3d6d77
remove POST /api/internal/v1/custom_buttons/{id}/action (#734)
* remove POST /api/internal/v1/custom_buttons/{id}/action
2022-10-28 10:44:37 +02:00
Joey Orlando
7974f32239
Revert "Revert "Remove migration-tool Django app and UI page (#708)"" 2022-10-27 15:42:21 +02:00
Ildar Iskhakov
00315e5c2d
Merge branch 'main' into dev 2022-10-27 21:28:44 +08:00
Joey Orlando
627afe37e1
Remove references to Alert.migrator_lock attribute
This commit patches issue related to #708.

#708 forgot to remove attributes on models outside of the migration_tool django app that were referencing model attributes from migration_tool.

The only attribute that referenced a field in migration_tool was migrator_lock on the Alert model. This commit removes any references to that attribute.
2022-10-27 13:52:03 +02:00
Joey Orlando
56c6a25dfb Revert "Remove migration-tool Django app and UI page (#708)"
This reverts commit 94934bf3e4.
2022-10-27 12:12:57 +02:00
Joey Orlando
94934bf3e4
Remove migration-tool Django app and UI page (#708)
* remove migration_tool app (#687)
* remove migration-tool page (#699)
2022-10-26 15:47:08 +02:00
Matias Bordese
2c8c66a8c8 Not previously handled backends (eg. mobile) could end here without a messaging backend 2022-10-26 09:30:13 -03:00
Michael Derynck
a37df38930 Merge branch 'dev' into mderynck/add-check-notify-group-task 2022-10-25 12:50:12 -06:00
Matias Bordese
8e2bcf5274 Fix failing test related to users org caching 2022-10-25 14:27:27 -03:00
Michael Derynck
ef097fcdd9 Add check for usergroup to notify group task 2022-10-25 10:23:19 -06:00
Matias Bordese
565cb84bb1 Add optional type filter to internal schedules endpoint 2022-10-25 12:51:06 -03:00
Innokentii Konstantinov
2c6a27154f
Support mutliregion telegram (#676)
* Support mutliregion telegram

* Fix test_personal_message

* Fix tg verification code tests

* Simplify /start cmd handler

* Comment about link with org_id in tg msg
2022-10-25 14:53:07 +08:00
Ben Sully
6ef687061c
Remove 'emoji' property from Slack markdown blocks in resolution notes (#702)
I'm seeing this error in the logs:

> invalid additional property: emoji [json-pointer:/blocks/0/text]

It looks like the 'emoji' argument is not supported when type: mrkdwn.
This PR removes that property in the same place that the change
to mrkdwn was made - see [this
PR](https://github.com/grafana/oncall/pull/646).
2022-10-24 16:15:04 +01:00
Ildar Iskhakov
1bf75d601d
Merge pull request #646 from grafana/slack-resolution-note-formatting
Use markdown formatting for web based resolution notes
2022-10-24 19:22:12 +08:00
Matias Bordese
eb32fa7ba0 Handle scenario when multiple general team manual integrations are available 2022-10-21 14:23:45 -03:00
Matias Bordese
a4830c74b7 Update ical event/user email matching to be case-insensitive 2022-10-20 16:12:41 -03:00
Matias Bordese
6439752949
Rewrite fallback condition for num escalation chains
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-10-20 12:57:59 -03:00
Matias Bordese
3d171f20f7 Defer large unused queryset fields when listing schedules 2022-10-19 17:07:06 -03:00
Matias Bordese
e4a7a5a23d Rework schedule escalation chains/policies count as a subquery 2022-10-19 17:07:06 -03:00
Yulia Shanyrova
fbc672b2d1 Merge branch '318-slack-installation-ux' into 637-telegram-installation-redesign 2022-10-19 13:49:05 +02:00
Vadim Stepanov
e67d3519fe
Restore email notifications (#621)
* remove email verification related code

* remove email verification related code

* remove sendgrid callback

* remove sendgrid related code

* remove sendgrid related code

* rename sendgrid app to email

* remove email from built-in channels

* remove email from built-in channels

* remove email from built-in channels

* add email backend: https://github.com/grafana/oncall/pull/50

* add email templater

* add email templater

* convert md to html

* add email settings to live settings

* use task to send email, handle some exceptions to create logs

* remove ERROR_NOTIFICATION_MAIL_DELIVERY_FAILED usage

* add email limit logic

* fix tests

* add docs

* remove old email templates

* remove old email templates

* add template_fields to messaging backend

* add messaging backends templates to public api

* add comment for deprecated fields

* fix test

* fix tests

* disable email by default

* don't retry on SMTPException and TimeoutError

* add tests

* bring email back to public api docs

* return ERROR_NOTIFICATION_MAIL_LIMIT_EXCEEDED

* make template_fields tuple

* build_subject_and_title -> build_subject_and_message

* add one more comment about template deprecation

* use 8 as backend id

* add comment about gaierror and BadHeaderError

* add comment on importing in notify_user_async

* edit oss docs
2022-10-19 12:32:56 +01:00
Ben Sully
e36757b293
Allow non-JSON custom webhook templates, provided they render as valid JSON (#639)
* Allow non-JSON custom webhook templates, provided they render as valid JSON

Previously, both the provided template _and_ the rendered template had
to be valid JSON in order for validation to pass. This was unnecessarily
restrictive: really, only the rendered template needs to be valid JSON.
It also disallowed using templates such as:

    {
      "labels": {{ alert_payload.labels | tojson }}
    }

even though this would be valid JSON after rendering.

This commit relaxes the validation of custom webhook templates so that
they don't need to be valid JSON, provided that the rendered template
_is_ valid JSON. This is checked using a dummy dictionary of render
params, which use a constant string for the `alert_group_id` field
and a `defaultdict(dict)` for the `alert_payload` field. This should
permit templates like the one above, but still deny templates such as

    {
      "labels": {{ alert_payload.labels }}
    }

which would otherwise fail later if `labels` is not valid JSON.

This should resolve #638.

* Use defaultdict(str) instead of defaultdict(lambda: "")

* Add missing comment to resolution note validation code

* Update validation of resolution notes in public API, too

* Add extra test cases for JSON webhook templates endpoint of public API
2022-10-19 12:32:21 +01:00
Michael Derynck
8e48c441e8
Merge pull request #651 from grafana/mderynck/handle-channel-filter-exception
Catch exception for parsing regex during channel filtering
2022-10-18 09:43:08 -06:00
Michael Derynck
8ad593b36f
Merge pull request #650 from grafana/mderynck/suppress-integration-exception
Add middleware to catch exception for missing integration
2022-10-18 09:16:09 -06:00
Michael Derynck
4eb814798c Make return value explicit 2022-10-18 08:05:01 -06:00
David van der Spek
292849e782
fix relation already exists (#660)
Signed-off-by: DavidSpek <vanderspek.david@gmail.com>

Signed-off-by: DavidSpek <vanderspek.david@gmail.com>
2022-10-18 14:04:27 +01:00
Michael Derynck
c731b9b113 Catch exception for parsing regex during channel filtering 2022-10-13 18:34:04 -06:00
Michael Derynck
5f5f427c9f Add middleware to catch exception for missing integration, reduce spamminess of logs 2022-10-13 17:18:22 -06:00
Ben Sully
def8b35e74
Use markdown formatting for web based resolution notes
We would like to include some more sophisticated content in our
resolution notes (specifically URLs), so need the resolution notes to be
rendered as Markdown for this.

This PR changes _all_ resolution note text blocks to be markdown, but
perhaps it would be better to allow the caller to specify that they
would prefer markdown to plain text (this would also allow backwards
compatibility). Let me know if you'd prefer that and I can try and
figure it out!
2022-10-12 13:05:16 +01:00
Yulia Shanyrova
06a5b5570a Slack integration redesign. Changed the message from backend as well 2022-10-11 11:35:51 +02:00
Matias Bordese
f378eab7b7 Allow enabling schedules alpha per organization 2022-10-05 14:06:42 -03:00
Yulya Artyukhina
e695093c6c
Merge pull request #540 from grafana/web-schedule-fixes
Web schedule fixes
2022-10-04 17:01:00 +03:00
Ildar Iskhakov
5187dbf913
Merge pull request #595 from toro-ponz/fix/slack-format-alert-failure
Fix failure of "Format Alert" button on Slack.
2022-10-04 17:05:39 +08:00
Ildar Iskhakov
2bc36440e6 Bump cryptography vertsion 2022-10-04 16:58:35 +08:00
Vadim Stepanov
b84b174e20
Allow multiple database and celery broker types (#582)
* add libs for celery + redis

* move redis & cache config to settings/base.py

* move rmq & celery config to settings/base.py

* BROKER -> BROKER_TYPE

* allow multiple database types

* flake8

* add sqlite db creation to dockerfile

* fix ci

* fix ci

* debug

* remove some defaults

* remove prints

* use local memory as cache on ci

* debug

* add DATABASE_DEFAULTS

* add ci test for sqlite + redis

* add ci test for sqlite + redis

* add ci test for sqlite + redis

* debug

* add redis healthcheck

* fix sqlite

* fix dev settings

* refactor dev settings

* tweak ci settings

* clear cache properly between tests

* move db and broker types to constants

* add librabbitmq deps

* use amqp instead of librabbitmq
2022-10-04 09:25:53 +01:00
Julia
461f284bb5 Merge branch 'dev' into web-schedule-fixes
# Conflicts:
#	engine/apps/schedules/ical_utils.py
#	engine/apps/schedules/models/custom_on_call_shift.py
2022-10-04 11:23:52 +03:00
Matias Bordese
2a3fc397db Clear users cache before schedule tests logic/asserts 2022-10-03 15:00:23 -03:00
Matias Bordese
f7c7803807 Fix related_users for no-shifts schedule 2022-10-03 14:27:22 -03:00
toro_ponz
afae3bc846 Merge remote-tracking branch 'upstream/dev' into fix/slack-format-alert-failure 2022-10-03 19:38:29 +09:00
Matias Bordese
f8314ef9c2
Fix timing issue with schedule tests reusing cached users (#592)
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-10-03 11:37:59 +01:00
Vadim Stepanov
5e272f8565
Fix failing tests due to bug in month calculations (#599) 2022-10-03 11:22:02 +01:00
toro_ponz
a8a88f5c00 remove wasted condition check. 2022-10-03 18:54:56 +09:00