Commit graph

2393 commits

Author SHA1 Message Date
Joey Orlando
47042decb7
don't enforce line-length rule for markdownlint for code-blocks or tables (#2145)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-09 06:57:19 +00:00
Innokentii Konstantinov
0b92210e16
Better simple phone provider (#2143)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-09 13:21:38 +08:00
pikilisaikiran
a0da31f745
Added nodeSelector for celery deployment and migrate job (#1085)
# What this PR does
Adds nodeSelector for celery deployment and migrate job

## Which issue(s) this PR fixes
Fixes errors while deploying resources in a cluster with Gatekeeper
policy ( that restricts deployments without nodeSelector).

## Checklist

- [x] Tests updated
- [x] Documentation added
- [x] `CHANGELOG.md` updated

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-06-08 20:53:11 +00:00
Matias Bordese
c1935ef46c
Update alert group view receive channel filter (#2140)
We were noticing some discrepancies in alert groups counts.

From a real example:

```
# queryset is the alert groups initial queryset
>>> qs = queryset.filter(channel_filter__alert_receive_channel=arc)
>>> qs.filter(resolved_at__isnull=False).count()
1318
>>> qs = queryset.filter(channel=arc)
>>> qs.filter(resolved_at__isnull=False).count()
1356
>>> qs.filter(resolved_at__isnull=False, channel_filter__isnull=True).count()
38
```
2023-06-08 19:49:48 +00:00
Ildar Iskhakov
f37c3a90d1
Edit route hint (#2114)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-09 00:34:32 +08:00
Matvey Kukuy
6e82e9400f Merge remote-tracking branch 'origin/dev' into dev 2023-06-08 18:48:35 +03:00
Matvey Kukuy
b30769e7b5 Docs fixes 2023-06-08 18:48:23 +03:00
Ildar Iskhakov
f14179b9b0
Fix demo-payload (#2139)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-08 23:31:18 +08:00
Yulia Shanyrova
b50b10d491
fix for templates for routes (#2136)
# What this PR does
- Wrong behaviour after saving Route template fix
- Add notification/error when try to save empty template for routes.
2023-06-08 15:20:46 +00:00
Ildar Iskhakov
18763c5073
Fix docs, change team to organization in ratelimits, as previously te… (#2135)
…am was equal to orgamization

# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

Co-authored-by: Matvey Kukuy <Matvey-Kuk@users.noreply.github.com>
2023-06-08 13:47:13 +00:00
Joey Orlando
4785f147d8
Update CHANGELOG.md 2023-06-08 06:44:16 -04:00
Yulia Shanyrova
7a569dae02
Fixes for search, for last alert payload and some design changes (#2129)
## Which issue(s) this PR fixes
Fixes for search, for last alert payload and some design changes
2023-06-08 08:16:16 +00:00
Innokentii Konstantinov
645199782a Update CHANGELOG.md 2023-06-08 15:37:53 +08:00
Alexander Cherepanov
f67cfd0494
Run containers as a non-root user (#2053)
# What this PR does

Create a custom non-root user and use it to start an app. So uwsgi does
not require to use `setUid` and `setGid` system calls.

It handles errors while starting in Kubernetes with `runAsNonRoot: true`
check.

## Which issue(s) this PR fixes

closes https://github.com/grafana/oncall/issues/445

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2023-06-08 07:12:00 +00:00
Innokentii Konstantinov
34bdaf8694 Update CHANGELOG.md 2023-06-08 14:55:35 +08:00
Innokentii Konstantinov
c7f8ac3559
Add BaseFailed exceptions for phone_notificator (#2074)
# What this PR does
Introduces BaseFailed exception for phone_notificator.

# Why
We need to somehow distinguish errors we want to be notified - like
network errors or invalid twilio credentials (I will call them "real"
errors) and errors we want to share with user, but don't want to be
paged ( I will call them "fake" errors).
To do that I added "graceful_msg" to all Failed... exceptions. If
details field is present - it mean we can return 400 code with the
message, if not - 500 code. So, "real" errors will raise Failed...
exception, while "fake" will add "graceful_msg".

# TODO
handle exceptions handled here
https://github.com/grafana/oncall/pull/2065
## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
2023-06-08 05:55:41 +00:00
Innokentii Konstantinov
306f842963
TwilioPhoneProvider optimizations (#2034)
# What this PR does
This PR does three improvements in twilio_phone_provider:
1.
[Speed-up](https://github.com/grafana/oncall/pull/2034/files#diff-7a311767169c024e60e2b4e35fd531dd6e2f1ea785cfc84263e11e7932d622af)
query which calculates amount of phone_calls/sms left.
2. Remove code which was needed only for backward compatibility during
the release of PhoneProvider refactoring and improves logging for
handling status/gather updates.
3. Add db_index to twilio_sid. We are doing lot of lookups by sid and
with increasing amount of data it became resource consuming.
2023-06-08 05:13:54 +00:00
Vadim Stepanov
04f1e4d27a
v1.2.40 changelog 2023-06-07 14:27:35 +01:00
Rares Mardare
6570790442
Rares/templates tweaks 5 (#2116)
# What this PR does

- Removed duplicate copy within Routes
- Made drawer content of templates more responsive
- Fetch telegram info and display it accordingly
- Fixed pagination being reset when going back to table view
- Some other minor things
2023-06-07 12:30:05 +00:00
Innokentii Konstantinov
a865ae1378
Fix backend for resolution notes via mobile app (#2117)
# What this PR does
Add first internal api error code and add "resolution_note" param to
resolve endpoint

## Which issue(s) this PR fixes
It fixes resolving alert groups via mobile app when resolution note is
required

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-07 12:19:16 +00:00
Vadim Stepanov
68605029e4
Make viewset actions more consistent (#2120)
# What this PR does

Makes sure that all viewset actions with `detail=True` use
`self.get_object()` to retrieve an instance that's being acted upon.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-07 12:10:53 +00:00
Innokentii Konstantinov
594a18a1b0
Fix phone code verification field (#2119)
# What this PR does
Fix issue when phone code verification field not became active after
verifying number via phone

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-07 11:07:47 +00:00
Joey Orlando
357adfbc21
make make test command much more robust + address several more backend test warnings (#2115)
# What this PR does

see more detailed comments under the "Files changed" tab

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-06-07 10:51:58 +00:00
Matvey Kukuy
130ec3cf0a
Using "sentence case" in the nav for consistency with the rest of grafana nav. (#1723)
Escalation Chains -> Escalation chains

etc.

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-06-07 05:20:53 +00:00
Joey Orlando
e6f554f5aa
update triage stale pull requests action to
start processing older pull requests first
2023-06-07 07:14:12 +02:00
Matvey Kukuy
971ef576ae
Main to dev (#2108)
Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: eldin <33036213+nikoalch@users.noreply.github.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
Co-authored-by: chrisharbro <102977229+chrisharbro@users.noreply.github.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-06-07 04:14:21 +00:00
Joey Orlando
ea9b7a6331
Fix warnings when running backend tests (#2079)
# What this PR does

- update `make test` to always use `settings.ci-test`. Right now it will
use whatever the value of `DJANGO_SETTINGS_MODULE` is in
`./dev/.env.dev`, which causes ~45 tests to fail
- Fix several Python warnings that we see when running the tests
```bash
RemovedInDjango40Warning: The providing_args argument is deprecated. As it is purely documentational, it has no replacement. If you rely on this argument as documentation, you can move the text to a code comment or docstring.
    alert_create_signal = django.dispatch.Signal(
```

```bash
PytestCollectionWarning: cannot collect test class 'TestOnlyBackend' because it has a __init__ constructor (from: apps/api/tests/test_alert_receive_channel_template.py)
    class TestOnlyBackend(BaseMessagingBackend):
```

```bash
DeprecationWarning: The parameter 'use_aliases' in emoji.emojize() is deprecated and will be removed in version 2.0.0. Use language='alias' instead.
  To hide this warning, pin/downgrade the package to 'emoji~=1.6.3'
    return emoji.emojize(self.verbal_name, use_aliases=True)
```

```bash
DateTimeField CustomOnCallShift.start received a naive datetime (2023-06-01 12:53:12) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"
```

```bash
apps/twilioapp/tests/test_phone_calls.py::test_resolve_by_phone
  /etc/app/apps/twilioapp/tests/test_phone_calls.py:173: DeprecationWarning: The 'text' argument to find()-type methods is deprecated. Use 'string' instead.
    content = BeautifulSoup(content, features="html.parser").findAll(text=True)
```

```bash
apps/twilioapp/tests/test_phone_calls.py::test_resolve_by_phone
apps/twilioapp/tests/test_phone_calls.py::test_wrong_pressed_digit
  /usr/local/lib/python3.11/site-packages/bs4/builder/__init__.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
```

```bash
apps/twilioapp/tests/test_phone_calls.py::test_forbidden_requests
  /usr/local/lib/python3.11/site-packages/social_django/urls.py:15: RemovedInDjango40Warning: django.conf.urls.url() is deprecated in favor of django.urls.re_path().
    url(r'^login/(?P<backend>[^/]+){0}$'.format(extra), views.auth,
```

```bash
apps/twilioapp/tests/test_phone_calls.py: 66 warnings
  /usr/local/lib/python3.11/site-packages/debug_toolbar/utils.py:255: DeprecationWarning: currentThread() is deprecated, use current_thread() instead
    thread = threading.currentThread()
```


## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-06 18:38:00 +00:00
Vadim Stepanov
3d7c044193
Fix Telegram ratelimit on live setting change (#2100)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/1103, inspired by
https://github.com/grafana/oncall/pull/1934.

Makes sure that:
1. `LiveSettings.validate_settings` is only called once per update
request and not called for any individual LiveSetting instance save.
2. `telegram.Bot.set_webhook` is only called once per request when
changing `TELEGRAM_WEBHOOK_HOST`.


## Which issue(s) this PR fixes

https://github.com/grafana/oncall/issues/1103

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-06 15:18:12 +00:00
Vadim Stepanov
3ec01c2855
Add inbound email address in integration API (#2113)
# What this PR does

Allows fetching inbound email address for an integration using public
API. There's a new field `inbound_email` that's only defined for inbound
email integration and `null` for any other integration types.

## Which issue(s) this PR fixes

https://github.com/grafana/oncall/issues/1989

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-06 13:08:54 +00:00
Joey Orlando
cf949ac8fe
Revert "Revert slack org does not exist changes breaking escalate command (#2057)" (#2096)
# What this PR does

Closes https://github.com/grafana/oncall-private/issues/1836

- Revert "Revert slack org does not exist changes breaking escalate
command (#2057)" + add some unit tests to ensure we don't break the
`/escalate` command in the future
- cleanup how we destructure the `payload` dict in the endpoint handler

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-06 12:53:45 +00:00
Joey Orlando
f1a8cd220b
add github action to triage stale pull requests (#2110)
# What this PR does

Use [this](https://github.com/actions/stale) GitHub Action to run a
cron-job every morning to triage stale pull requests. The messages
posted to the pull request when stale/closed were borrowed from the
`grafana/grafana` repo
([example](https://github.com/grafana/grafana/pull/65754)).

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-06 08:37:06 -04:00
Yulia Shanyrova
ed7da1953f
UID has been added to Integrations table, Integration page and routes (#2112)
# What this PR does
UID has been added to Integrations table, Integration page and routes
2023-06-06 11:59:21 +00:00
Joey Orlando
0a78b99fd8
allow mobile app to consume internal schedules api endpoints (#2109)
# What this PR does

allow mobile app to consume internal schedules api endpoints

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-06 08:46:17 +00:00
Michael Derynck
bc535ac5df
Webhooks 2 hide secrets (#2104)
Replace password and authorization header fields with placeholders when
returning data to the UI. Mask the authorization header field when
editing and in the status logs.
2023-06-06 07:59:12 +00:00
Ildar Iskhakov
889c0afab9
Update CHANGELOG.md 2023-06-06 10:11:11 +08:00
Ildar Iskhakov
df0aedc8b4
Update CHANGELOG.md 2023-06-06 09:46:41 +08:00
Ildar Iskhakov
d9a1a33703
Update CHANGELOG.md 2023-06-06 09:45:23 +08:00
Matias Bordese
021cf095a2
Add support to update web schedule rotations in-place (#2102) 2023-06-05 17:24:59 +00:00
Joey Orlando
7ed6290d42
public API endpoint to export schedule final shifts (#2047)
# What this PR does

Closes https://github.com/grafana/oncall-private/issues/1632

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-05 14:06:10 +00:00
Alexander Cherepanov
5f067af14f
Do not hide not secret settings in the web plugin UI (#1964)
# What this PR does

In the web plugin UI Settings -> Env Variables if variable is not
secret, do not hide its value.

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-06-05 12:25:51 +00:00
Jack Baldry
d3921a5386
Remove absolute aliases as it can cause unexpected redirects in future versions (#1793)
If a page is removed in a future version, the presence of a "latest"
absolute alias in a previous version can redirect that removed page.

**Notes for reviewer:**
I would like to make similar changes for older, previously published
versions.
I believe you are only publishing documentation on specific tag events
and are not maintaining long lived release branches for backporting
fixes into.
If my understanding is correct, I will make the changes in the website
repository
(https://github.com/grafana/website/tree/master/content/docs/oncall).

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
2023-06-05 09:03:38 +00:00
Ildar Iskhakov
d8e42c731d
Add 413 for requests with content-length > 15Mb on uwsgi (#2095)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-05 16:43:10 +08:00
Ildar Iskhakov
1bdb54df35
Remove request reading middleware as we use post-buffering (#2094)
# What this PR does

RequestBodyReadingMiddleware is excess as [post-buffering is
enabled](https://github.com/grafana/oncall/blob/dev/engine/uwsgi.ini#L17):

If an HTTP request has a body (like a POST request generated by a form),
you have to read (consume) it in your application. If you do not do
this, the communication socket with your webserver may be clobbered. If
you are lazy you can use the post-buffering option that will
automatically read data for you. For Rack applications this is
automatically enabled.
(https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html)

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-05 11:49:39 +08:00
Matias Bordese
71f9505db8
Update CHANGELOG.md 2023-06-02 14:33:50 -03:00
Matias Bordese
0ab5312bf1
Use X-WR-TIMEZONE as calendar tz when available, fallback to UTC (#2091)
When checking current shifts to trigger slack notifications, a stable
value for timezone should be used (to avoid triggering multiple
duplicated notifications; using the first `VTIMEZONE` value available
may change on refresh, besides being potentially incorrect).

Also, `VTIMEZONE` shouldn't be used as the calendar timezone, it just
describes a [timezone
definition](https://icalendar.org/iCalendar-RFC-5545/3-6-5-time-zone-component.html)
which can later be [used when specifying a start/end
date/datetime](https://icalendar.org/iCalendar-RFC-5545/3-2-19-time-zone-identifier.html)
("The parameter MUST be specified on properties with a DATE-TIME value
if the DATE-TIME is not either a UTC or a "floating" time.").

OTOH, Google uses the non-standard[ `X-WR-TIMEZONE`
](https://github.com/collective/icalendar/issues/343)field as fallback
TZ for date-times without a `TZID`. Try to use this when available,
otherwise fallback to `UTC`.
2023-06-02 17:28:04 +00:00
Michael Derynck
8dfa929d5d
Use same account for status callback when using TwilioSender (#2083)
Fixes an issue where if a sender is defined for a certain country code
and that sender belongs to a different account than the default from the
environment the status callback would get a 443 response from OnCall
back to Twilio. Checking permission on status callbacks will now use the
same account as was used to send the original message, verify, or make
the call.
2023-06-02 17:19:36 +00:00
Yulia Shanyrova
85d5e57331
fix for MonacoEditor height (#2089)
## Which issue(s) this PR fixes
When Opening Template Editor, on first load Monaco editor height is 0
2023-06-02 12:33:52 +00:00
dimitar-ivanov-93
ef258f5f56
Social auth exception logging (#2041)
This will vastly improve troubleshooting when an unexpected error
occurs.

# What this PR does
Enables logging of the exception that might be thrown by
SocialAuthExceptionMiddleware. It vastly improves the speed and accuracy
of troubleshooting requests to external applications with the aim to
authenticate, since there is usually no response to look at.
## Which issue(s) this PR fixes
Closes [#2035](https://github.com/grafana/oncall/issues/2035)
## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
2023-06-02 11:20:54 +00:00
Vadim Stepanov
8c8b5e0f2d
Fix demo alert for inbound email (#2081)
# What this PR does
Fix HTTP 500 when sending demo alert for inbound integration email. 

- Make all integration configs have consistent `is_demo_alert_enabled`
and `example_payload` values
- Add tests

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-02 09:44:32 +00:00
Matias Bordese
362c382df2
Update CHANGELOG.md 2023-06-01 15:10:52 -03:00