Commit graph

358 commits

Author SHA1 Message Date
Michael Derynck
cbde8cd680 Merge branch 'dev' into add-region-to-organization 2022-10-28 09:20:16 -06: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
Michael Derynck
942e30bdb3 Lint 2022-10-27 15:47:53 -06:00
Michael Derynck
9d7c370752 Merge branch 'dev' into add-region-to-organization 2022-10-27 15:41:35 -06:00
Michael Derynck
a912a786de Add tests 2022-10-27 15:40:46 -06: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
Michael Derynck
37825059ff Add region sync and reverse proxy for migration 2022-10-24 21:25:32 -06:00
Michael Derynck
5955b2a81c Remove unused function 2022-10-24 11:15:58 -06: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
Michael Derynck
a3a0b22947 Merge branch 'dev' into add-region-to-organization 2022-10-24 09:14:30 -06: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
Michael Derynck
724278fbc8 Regenerate migrations after complete to consolidate 2022-10-21 14:03:19 -06:00
Matias Bordese
eb32fa7ba0 Handle scenario when multiple general team manual integrations are available 2022-10-21 14:23:45 -03:00
Michael Derynck
febe1b2185 Add basic organization moved exception handling and middleware 2022-10-20 15:04:58 -06: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
Michael Derynck
0a1a9ab4d8 Add region object 2022-10-20 09:45:48 -06: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
Michael Derynck
330f103844 Merge branch 'dev' into add-region-to-organization 2022-10-19 11:00:59 -06: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
Michael Derynck
fa5d4f2674 Add region_slug column to organization 2022-10-11 12:04:33 -06: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
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