Commit graph

1812 commits

Author SHA1 Message Date
Innokentii Konstantinov
249e4067c4 Remove unused def render_resolution_notes_for_csv_report 2023-03-07 13:47:49 +08:00
Joey Orlando
6ad30bfd33
remove dependabot config 2023-03-06 17:40:23 +01:00
Joey Orlando
8f22b2fd74
first UI integration test - phone verification + receive SMS alert flow (#900)
**What this PR does**:
Adds our first UI integration test using
[Playwright](https://playwright.dev/) and runs the test on CI. Right now
the test:
- logs into Grafana
- configures the plugin (if it isn't already)
- creates an OnCall schedule, where the current user will be OnCall
- creates an escalation chain to notify based on the newly created
OnCall schedule
- creates a webhook integration, attached to the created escalation
chain
- sends a demo alert for the new integration
- goes to the alert groups page and validates that the escalation step
to alert the OnCall user actually happened

Currently the Playwright tests are run against the 3 default headless
browsers, chromium, Firefox, and webkit. The CI job that runs these
tests is run as a matrix against 3 tagged versions of `grafana`; `main`,
`latest`, and `9.2.6`.

Secondly, it adds most of the logic for a second test which:
- logs into Grafana
- configures the plugin (if it isn't already)
- goes to the user's settings, verifies their phone number (using a tool
called [MailSlurp](https://www.mailslurp.com/))
- configures the current user's default escalation policy to send alerts
via SMS
- creates an escalation policy and configures it to send alerts to our
current user
- creates an integration and assigns the created escalation policy
- triggers a test alert + verifies that we receive the SMS alert text
(again, using MailSlurp)

**Which issue(s) this PR fixes**:
Closes #873 

**Checklist**
- [x] Tests updated
- [ ] Documentation added (N/A)
- [ ] `CHANGELOG.md` updated (N/A)
2023-03-06 16:28:52 +00:00
Vadim Stepanov
ab493def5f
Schedule quality backend improvements (#1461)
# What this PR does

Changes the schedule quality API so it also returns types of comments
(this is needed to address
https://github.com/grafana/oncall/issues/118#issuecomment-1436954708).

## Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall/issues/118

## Checklist

- [x] Tests updated
2023-03-06 14:27:49 +00:00
Vadim Stepanov
a194bdc72b
PD migrator: fix layer levels (#1455)
# What this PR does
Current implementation of PD migrator creates schedule layers with
priority levels starting from 0.
This PR makes so layers start from 1, so it's closer to original PD
schedules that are starting from 1.

## Checklist

- [x] Tests updated
2023-03-06 14:01:35 +00:00
Vadim Stepanov
c20229fefd
PD migrator: migrate overrides (#1454)
# What this PR does
Allows PD migrator to migrate overrides (the current implementation only
migrates rotation layers).
Also tweaks public API so created overrides are consistent with the web
UI.

## Checklist

- [x] Tests updated
2023-03-06 13:44:28 +00:00
Innokentii Konstantinov
19f1491e3a
Fix wording for cloud notifications (#1458)
# What this PR does
Fix message on Phone Verification tab.
2023-03-06 09:43:00 +00:00
Innokentii Konstantinov
4b91203eca
Add validation of hostname for recapctha (#1445)
# What this PR does

- Implement recapthca v3 check. DRF_RECAPTCHA didn't support hostname
validation and it's too complicated to add it.
- Add validation of verification code on oncall side to not to call
twilio with obviously invalid codes

## Checklist

- [x] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-06 08:59:48 +00:00
Rares Mardare
d182e71f62
fix for #1273, added component for showing permission restricted acce… (#1422)
# What this PR does

- Removed unused code
- Added another component for displaying Error Messages based on
permissions access (so that we do not duplicate this code everywhere
it's needed)
- Fix for #1273 

## Which issue(s) this PR fixes

- #1273 

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-02 15:32:59 +00:00
Matvey Kukuy
2a311c6289
Incident -> Alert Group wording (#1450) 2023-03-02 15:03:58 +00:00
Vadim Stepanov
5f4a791abb
Update CHANGELOG.md 2023-03-01 17:00:33 +00:00
Vadim Stepanov
8170ca491c
Fix pagination issue when searching schedules (#1437)
# What this PR does
Fixes a bug with inconsistent schedule count when searching by name.

Example (2 schedules returned, but count is incorrectly set to 12):

![image](https://user-images.githubusercontent.com/20116910/222198919-2f2124bc-52b2-4e5f-a949-79bbf89a5a26.png)

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated
2023-03-01 16:28:40 +00:00
Rares Mardare
1b0643fef2
Schedule Filters tweaks (#1406)
# What this PR does

Improvements over schedule filters

## Which issue(s) this PR fixes

#941 

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [x] `CHANGELOG.md` updated
2023-03-01 13:30:01 +00:00
Vadim Stepanov
4c31ede558
Add "used in escalation" filter for schedules internal API (#1425)
# What this PR does
Adds a `used` filter on schedules endpoint for internal API.

Usage:
- `?used=true` returns schedules that are referenced by at least one
escalation policy
- `?used=false` returns schedules that are NOT referenced
- `?used=null` or not providing the query param at all will return all
schedules
## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1423

## Checklist

- [x] Tests updated
2023-03-01 10:09:07 +00:00
Yulia Shanyrova
173a02c7d3
1387 source link redesign (#1419)
# What this PR does
Source link is not related with Integration, so it is just a label now
Icon of integration moved to Integration label-link
Incident word was removed from "1 attached Incidents"

## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1387
2023-03-01 09:23:25 +00:00
Innokentii Konstantinov
7f706c5a26 Update CHANGELOG.md 2023-03-01 17:05:25 +08:00
Innokentii Konstantinov
6a5e75e083
Fix of templates api behaviour for public and private api (#1408)
# What this PR does

This PR fixes templates behaviour for public and private api. It fix
"reset to default" for templates from messaging backends and some minor
bugs. Also added acknowledge signal and source link templates

## Checklist

- [x] Tests updated
- [x] Documentation added
- [x] `CHANGELOG.md` updated
2023-03-01 16:32:15 +08:00
Innokentii Konstantinov
d1d8a9ae32 Update CHANGELOG.md 2023-03-01 14:56:20 +08:00
Vadim Stepanov
a25fd429da
Show 100 latest alerts on alert group page (#1417)
# What this PR does
Make internal API return 100 latest alerts for alert group.

## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/857

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated
2023-02-28 14:12:56 +00:00
Maxim Mordasov
bee9943706
#415 #1292 #940 #1293 #1002 bug fixes (#1356)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [x] `CHANGELOG.md` updated
2023-02-27 16:27:11 +00:00
Rares Mardare
c0873007b0
Fix NPE on ScheduleForm (#1410)
# What this PR does

Fixes NPE on `<ScheduleForm />` when the schedule has not been loaded.
2023-02-27 15:21:28 +00:00
Matias Bordese
04c42e2796
Matiasb/fix task refresh ical when empty value (#1401)
This should fix task error as seen in logs, trying to parse an empty
string as ical value:
```
Task apps.schedules.tasks.refresh_ical_files.refresh_ical_file[] raised unexpected: ValueError("Found no components where exactly one is required: ''")
```
2023-02-24 21:16:09 +00:00
Matias Bordese
721ab9fbb9
Use UTC instead of Etc/UTC when passing tz to dateutil rrule (#1414)
Fixes https://github.com/grafana/oncall-private/issues/1648
2023-02-24 20:54:20 +00:00
Michael Derynck
b3659872a7
Get reCAPTCHA site key from backend env (#1400)
# What this PR does
Move reCAPTCHA site key to backend environment for easier management to
support multiple environments.

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [x] `CHANGELOG.md` updated
2023-02-24 15:53:35 +00:00
Joey Orlando
71f81f844a
fixed UI permission related bug where Editors could not export their user iCal link (#1412)
# Which issue(s) this PR fixes

https://www.loom.com/share/c6da9a51786a483999b19eba94c7e2f5

## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-02-24 16:27:11 +01:00
Vadim Stepanov
10cf1055b1
PD migrator: create shifts in UTC timezone (#1411)
# What this PR does
Make PagerDuty migrator create shifts in UTC timezone when migrating web
schedules.

## Checklist

- [x] Tests updated
2023-02-24 15:05:10 +00:00
Matias Bordese
98b3b918a5
Add schedule pagination to plugin API (#1309)
Related to #1289

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-02-24 14:59:03 +00:00
Michael Derynck
49946e6a4e
Change Organization Deleted/Moved Precedence (#1402)
# What this PR does
When an organization is migrated to a different cluster it has it's
`migration_destination_slug` set for redirection purposes but it also
needs to be deleted so scheduled tasks for it do not run in the old
cluster. By changing the order so moved has precedence over deleted API
calls will be correctly redirected for moved organizations while the
organization is still considered deleted to suppress tasks that are no
longer needed in the old cluster.

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-02-24 11:45:21 +00:00
Rares Mardare
12a04db2ed
Append grafana styles to head instead of referencing the wrong path (#1348)
# What this PR does

Fixed #672 so that we import the css as a whole and add it as a `style`
element, instead of relying on path location which can differ if url is
rewritten.

## Which issue(s) this PR fixes

#672 

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-02-24 11:14:45 +00:00
Vadim Stepanov
e2392988c8
PD migrator: handle deactivated users in PD when migrating schedules (#1407)
# What this PR does
Handle deactivated users in PD when migrating schedules using PD
migrator.

## Checklist

- [x] Tests updated
2023-02-24 11:12:10 +00:00
Yulia Shanyrova
52ea445f6c
tabs added to url for chatops (#804)
**What this PR does**:

**Which issue(s) this PR fixes**:

**Checklist**
- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-02-24 10:33:32 +00:00
Matias Bordese
b6ce63e2a9
Fix/rewrite flaky schedule tests (#1397) 2023-02-23 18:20:51 +00:00
Vadim Stepanov
82694bf7c5
Update CHANGELOG.md 2023-02-23 13:55:22 +00:00
Joey Orlando
b61f2ce41f
patch minor sync issue when HTTP 302 is received from Grafana API instance (#1393)
# What this PR does

this PR refactors the `sync_organization` and
`GrafanaAPIClient.is_rbac_enabled_for_organization` methods to check the
connected response bool rather than explicit check on HTTP 200. This
handles the legitimate case where the Grafana instance may return an
HTTP 302 (redirect) rather than an HTTP 200.

## Which issue(s) this PR fixes

See
[this](https://grafana.slack.com/archives/C02LSUUSE2G/p1677136582890269)
Slack thread in the community channel for more context

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-02-23 13:23:57 +00:00
Vadim Stepanov
a2eed312f9
PD migrator: migrate on-call shifts using public API (#1317)
Allow PD migrator tool to migrate on-call shifts when migrating
schedules (currently it migrates schedules using PD ICal file):
https://github.com/grafana/oncall/issues/1283.

This PR will allow to select the mode of schedule migration via
`SCHEDULE_MIGRATION_MODE_WEB` env variable (`ical` or `web`). Due to
differences in the scheduling systems of PD and OnCall, it's not always
possible to migrate shifts automatically (migration plan will show any
schedules and layers that can't be migrated).

PD rotations that will be possible to migrate:
- Any rotation without restrictions ("restriction" is a PD term for
describing active periods for rotation)
- Daily rotations with daily restrictions
- Weekly rotations with weekly restrictions
- Some weekly rotations with daily restrictions
- Some daily rotations with weekly restrictions

There will be a separate PR to update the
[instruction](https://github.com/grafana/oncall/tree/dev/tools/pagerduty-migrator#readme)
since this one is pretty huge already.
2023-02-23 11:34:03 +00:00
Yulya Artyukhina
53af4783de
Fix the cause of retry of notify_all and notify_group tasks (#1376)
Fix the cause of retry of notify_all and notify_group tasks that was
related to an incorrect step order.
2023-02-23 09:28:13 +00:00
Innokentii Konstantinov
ba314077a4 Update CHANGELOG.md 2023-02-23 15:47:43 +08:00
Innokentii Konstantinov
26a2bd9c91
Refactor maintenance (#1340)
# What this PR does
This PR simplifies code of maintenance mode.
1. Perform distribution/escalation maintenance checks in send_signal...
tasks.
2. Use usual alert distribution flow for the maintenance incident.
3. Decouple maintenance mode from slack (all, except
**notify_about_maintenance_action** methods, I don't want to make this
PR too big)

As a bonus from these changes, maintenance mode now mute alert group
delivery in all chatops integrations, not only in slack. (Before,
incidents happened while maintenance were posted to telegram and msteams
anyway)

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-02-23 07:13:03 +00:00
Yulia Shanyrova
d99f6920c5
Handling throttling error on frontend when verifying phone number (#1375)
# What this PR does
If 429 error code received from backend we show notification with Error
"Too many requests. Please try in {min} minutes"

## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1357

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-02-22 16:29:54 +00:00
Joey Orlando
ec9a4b2575
don't run changelog/public-docs CI checks on merge_group Github events (#1388)
They don't appear to work properly there:
![Screenshot 2023-02-22 at 16 00
39](https://user-images.githubusercontent.com/9406895/220663834-82b125fa-0a9e-4aff-9399-62563a312842.png)
![Screenshot 2023-02-22 at 16 00
53](https://user-images.githubusercontent.com/9406895/220663841-1af2d0a7-e910-4d84-94a8-0cdec4f0353d.png)
2023-02-22 16:18:25 +01:00
Joey Orlando
4c231e4a01
trigger github actions jobs on merge_group event (#1346)
Get the repo ready to support the [pull request merge
queue](https://github.blog/changelog/2021-10-27-pull-request-merge-queue-limited-beta/):
<img width="777" alt="Screenshot 2023-02-20 at 14 48 44"
src="https://user-images.githubusercontent.com/9406895/220125516-4b2f7245-fb6d-4517-933e-d9cf86308661.png">
2023-02-22 15:05:48 +01:00
Joey Orlando
b3ad70abb3
update CHANGELOG 2023-02-22 07:42:17 +01:00
Innokentii Konstantinov
59f83ed331
Revert "Revert "Rework schedules cached ical file values"" (#1382)
Reverts grafana/oncall#1377
2023-02-22 07:30:19 +01:00
Innokentii Konstantinov
f4ee99eb7b
Fix load of ical file from google (#1381) 2023-02-22 07:29:59 +01:00
Matias Bordese
b02dc6bd36
Revert "Rework schedules cached ical file values" (#1377)
Reverts grafana/oncall#1312

This change seems to have introduced some unexpected behavior with slack
user groups. Reverting to reproduce locally and push an improved update.
2023-02-22 10:16:49 +08:00
Innokentii Konstantinov
c733d8b9f2
Cleanup ScenarioStep (#1213)
# What this PR does
This PR cleanup ScenarioStep. It's needed to simplify moving Slack to
the messaging backends in future.

1. Introduce AlertGroupSlackService to move logic from ScenarioStep.
Also it allowed to get rid of importing ScenarioSteps in the code not
related to processing of slack callbacks.
2. Remove tags from ScenarioSteps, they are unused.
3. Remove ScenarioStep.dispatch method. It just was calling
ScenarioStep.process_scenario.
4. Remove "action" param from process_scenario, it was unused.
5. Remove creation of SlackActionRecord on handling SlackEvents. We are
not using it, but it generates INSERT query on most of the user-slack
interactions.
6. Remove "random_prefix_for_routing" from ScenarioStep, it was unused.
## Which issue(s) this PR fixes

## Checklist

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

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-02-21 20:22:11 +01:00
Joey Orlando
c55a9010f7
Add Google reCAPTCHA for mobile app phone verification (#1373)
# What this PR does

Adds reCAPTCHA validation to the get mobile verification code endpoint

## Which issue(s) this PR fixes

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated

---------

Co-authored-by: Maxim <maxim.mordasov@grafana.com>
2023-02-21 20:17:06 +01:00
Yulia Shanyrova
2cf83a9650
1305 backlink tosource (#1316)
# What this PR does
- Header of Incident page was reworked: clickable labels instead of just
names, users section was deleted
- Go to Integration button was deleted, because the functionality moved
to clickable labels
- Link to source was added
- 
## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/1305

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ v] `CHANGELOG.md` updated
2023-02-21 11:47:21 +00:00
Joey Orlando
b5f88cfc8f
bump dependabot schedule interval to monthly (#1372) 2023-02-21 10:37:26 +01:00
Joey Orlando
11531119d2
code-ify dependabot configuration (#1347)
# What this PR does

This PR is meant to code-ify our dependabot configuration. This is being
done mainly to override the default labels that dependabot adds to the
PRs it opens.

## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [ ] `CHANGELOG.md` updated (N/A)
2023-02-21 10:21:05 +01:00