Commit graph

222 commits

Author SHA1 Message Date
Michael Derynck
33a0c15b75
Truncate slack block text so it is not rejected by slack API (#5121)
# What this PR does
Truncates text for slack message to avoid this error:
```
File "/usr/local/lib/python3.12/site-packages/slack_sdk/web/slack_response.py", line 199, in validate
    raise e.SlackApiError(message=msg, response=self)
slack_sdk.errors.SlackApiError: The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)
The server responded with: {'ok': False, 'error': 'invalid_blocks', 'errors': ['failed to match all allowed schemas [json-pointer:/blocks/0/text]', 'must be less than 3001 characters [json-pointer:/blocks/0/text/text]'], 'response_metadata': {'messages': ['[ERROR] failed to match all allowed schemas [json-pointer:/blocks/0/text]', '[ERROR] must be less than 3001 characters [json-pointer:/blocks/0/text/text]']}}
```

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-10-03 18:45:23 +00:00
Matias Bordese
8754f60530
Update schedule related users to use cached final representation (#5101)
Related to https://github.com/grafana/oncall/issues/4936

Cached final schedule keeps a (now - 15d, now + 6m) window
representation of a schedule (this representation always use users'
username; it will un-relate users that are not anymore associated to a
schedule).
2024-10-01 13:37:28 +00:00
Vadim Stepanov
e287dec9b5
Make Slack connection error more descriptive (#5007)
# What this PR does

<img width="517" alt="Screenshot 2024-09-10 at 17 11 51"
src="https://github.com/user-attachments/assets/086eb4ae-6ea3-467c-a1ed-6d6f51ddc3e7">


<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-09-10 16:24:09 +00:00
Matias Bordese
22cd4b86fc
Handle Slack invalid_auth error when posting alert group notification (#4970)
Also, make telegram error check more flexible (case insensitive, e.g. we
got some of these recently: `telegram.error.Unauthorized: Forbidden: bot
was blocked by the user`)
2024-09-02 16:37:27 +00:00
Yulya Artyukhina
c87d3018b9
Handle TimeoutError on sending message to Slack (#4916)
# What this PR does

## Which issue(s) this PR closes

Related to https://github.com/grafana/oncall-private/issues/2758

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-26 10:27:07 +00:00
Alyssa Wada
070abb9d4f
docs: unified slack (#4844)
# What this PR does
Adds documentation to support the Unified IRM Slack integration

## Which issue(s) this PR closes

Related to
[issue](https://github.com/grafana/technical-documentation/issues/961)

---------

Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
2024-08-22 07:58:26 +00:00
Innokentii Konstantinov
5d92db18b1
Make root command configurable (#4863)
Makes IRM root command configurable via env
2024-08-21 06:54:47 +00:00
Joey Orlando
82410429b4
remove leftofter/deprecated slack log report tasks (#4858)
# What this PR does

Follow up to https://github.com/grafana/oncall/pull/4686

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-19 19:10:46 -04:00
Ildar Iskhakov
48725888d1
Move slack log report from message thread to button (#4686)
# What this PR does

Continuation of [Add slack button to show log report
#4641](https://github.com/grafana/oncall/pull/4641)

## Which issue(s) this PR closes

Closes https://github.com/grafana/oncall/issues/3849

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2024-08-19 20:17:06 +00:00
Innokentii Konstantinov
27c741213f
Escalate deprecation messages (#4811)
# What this PR does
Add two deprecations messages for /escalate command
1. If integration is not yet upgraded to Grafana IRM Slack integration -
just ephemeral message asking to upgrade
2. If integration is already upgraded - deprecation message, command
will not work, but ask to use /grafana-irm escalate
2024-08-15 08:34:33 +00:00
Matias Bordese
a1c67cdfe7
Address deprecation warnings in tests (#4681)
Related to https://github.com/grafana/oncall/issues/4496

[No
warnings](https://github.com/grafana/oncall/actions/runs/10359091611/job/28674729718?pr=4681#step:5:305)!
2024-08-13 20:51:18 +00:00
Innokentii Konstantinov
b3119e5266
chore: return 422 on slack step not found (#4810)
# What this PR does
Return 422 instead of 500 when the handler for the slack incoming event
was not found to gracefully omit events on call not subscribed to.
2024-08-13 07:57:17 +00:00
Joey Orlando
93c92a7a4c
Update Slack user group for a schedule - handle paid_team_only Slack API error (#4793)
# What this PR does

Semi-related to https://github.com/grafana/oncall-private/issues/2131

Addresses occasional task failures for
`apps.slack.tasks.update_slack_user_group_for_schedules` when trying to
update a Slack user group for a non-paid Slack account. [Slack's
documentation](https://slack.com/help/articles/212906697-Create-a-user-group)
mentions this is a paid only feature, hence the error
([logs](https://ops.grafana-ops.net/goto/-AWfsrrIR?orgId=1) from an
actual task):
```
2024-08-08 16:20:36,613 source=engine:celery worker=ForkPoolWorker-16 task_id=6bdaae94-1552-4b6d-93e2-e2fa0bae57b1 task_name=apps.slack.tasks.update_slack_user_group_for_schedules name=apps.slack.models.slack_usergroup level=WARNING Slack usergroup S06LW5GJ88Z update failed: Slack API error! Response: {'ok': False, 'error': 'paid_teams_only'}
```

Updated our docs on our Slack integration to emphasize that this feature
_only_ works for paid Slack accounts

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-09 14:51:01 +00:00
Yulya Artyukhina
b755404518
Don't send request for permalink if slack token has been revoked (#4777)
# What this PR does
Don't send request for permalink if slack token has been revoked

## Which issue(s) this PR closes

Related to https://github.com/grafana/oncall-private/issues/2843

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-06 15:34:08 +00:00
Innokentii Konstantinov
1faffb3dae
chore: grafana-irm command (#4762) 2024-07-31 11:50:07 +00:00
Ildar Iskhakov
5a9f124ba7
Stop posting new slack log reports (#4750)
Stop posting a new message, as it is available from the button
(https://github.com/grafana/oncall/pull/4641)
This is an intermediate step, so we will only update posted messages but
not post new ones
Once the majority of messages are updated, we can remove this step
(https://github.com/grafana/oncall/pull/4686)
2024-07-29 12:16:36 +00:00
Vadim Stepanov
b27a158eb0
Fix /escalate predefined org (#4723)
Related to https://github.com/grafana/oncall-gateway/issues/276

Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
2024-07-24 10:44:47 +00:00
Innokentii Konstantinov
94219c25bb
Introduce slash command matcher (#4717)
With the Unified Slack app we now have two ways of calling commands.
1. Legacy one when command invoked directly: /escalate
2. Unified one: /grafana escalate
On top of that we have different slach commands for each environment:
/escalate-local, /escalate-dev, etc. It was leading to a weird command
to escalate via Unified App in dev u need to type: /grafana-dev
escalate-develop.

To support both, I introduced a matcher function for SlashCommandRoutes.
It allows to simplify handling of such cases without complex workarounds
in an EventAPIEndpoint.


# What this PR does

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-07-24 09:53:06 +00:00
Vadim Stepanov
87d7982250
Unified Slack app reinstall (#4682)
# What this PR does

Adds a button to reinstall the Slack app to migrate to Unified Slack
App. Also adds backend support for this.

<img width="1204" alt="Screenshot 2024-07-18 at 18 33 08"
src="https://github.com/user-attachments/assets/a326b4a2-fc65-4b88-98c0-2955e3717e3a">


## Which issue(s) this PR closes

Related to https://github.com/grafana/oncall-gateway/issues/252

<!--
*Note*: if you have more than one GitHub issue that this PR closes, be
sure to preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-07-19 11:53:06 +00:00
Innokentii Konstantinov
1465db36e5
Support stack header from chatops-proxy (#4578)
This PR supports new flow of selecting org to run command in a slack
workspace if several stacks are using it. In this case user selects
default stack to run commands or pass a --stack flag. Both handled by
chatops-proxy which injects selected stack as a header.
On a side note - I found one ScenarioStep with incompatible set of
arguments with parent class. I didn't fixed it, just left TODO
https://github.com/grafana/oncall/pull/4578/files#diff-e323b5f38ed665f73d5da3fa0575958ed54ab587f6521b4cd87e1491b5430f8bR364

Related to https://github.com/grafana/oncall-gateway/issues/256

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2024-07-19 10:08:52 +00:00
Ildar Iskhakov
deff52df07
Add slack button to show log report (#4641)
# What this PR does

Add a button to show an alert group log report in Slack. After deployed
we can remove it from the thread as requested in
https://github.com/grafana/oncall/issues/3849

<img width="534" alt="Screenshot 2024-07-09 at 11 29 48 PM"
src="https://github.com/grafana/oncall/assets/2262529/a17cd366-e97b-4e61-bf06-172fb4737d56">
<img width="673" alt="Screenshot 2024-07-09 at 11 29 57 PM"
src="https://github.com/grafana/oncall/assets/2262529/a67dbe49-1972-45e6-a8b1-ce03ffe6951b">




## Which issue(s) this PR closes

Closes [issue link here]

<!--
*Note*: if you have more than one GitHub issue that this PR closes, be
sure to preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-07-12 09:49:09 +00:00
Ildar Iskhakov
993725d2ee
Show incident button first when alert group is acknowledged (#4642)
# What this PR does

* Move declare incident button to first position when incident is
acknowledged
* Move resolved text above buttons, so buttons remain on the same place
when clicked
<img width="549" alt="Screenshot 2024-07-09 at 11 52 33 PM"
src="https://github.com/grafana/oncall/assets/2262529/68cfb42f-c7ad-42b9-8404-e3400eb70332">
<img width="529" alt="Screenshot 2024-07-09 at 11 52 41 PM"
src="https://github.com/grafana/oncall/assets/2262529/d8e36dec-ddfc-4db6-9918-0fb478c1462f">


## Which issue(s) this PR closes

Closes https://github.com/grafana/oncall/issues/1908

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2024-07-10 15:01:01 +00:00
Vadim Stepanov
6e0bebaa11
Make Slack URLs work without trailing slashes (#4607)
Related to https://github.com/grafana/oncall-gateway/issues/254
2024-07-03 15:55:54 +00:00
Vadim Stepanov
615081a112
Inject chatops-proxy metadata into direct paging user dropdown (#4556)
Related to https://github.com/grafana/oncall-gateway/issues/240

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-06-21 10:11:23 +00:00
Innokentii Konstantinov
bc6272744b
Post stack slug to chatops proxy (#4559)
# What this PR does
It's part of work on
https://github.com/grafana/oncall-gateway/issues/247. I added stack_slug
to call to the chatops-proxy tenant/register API.
On a side note I figured out that we didn't cleanup slack integration in
chatops-proxy, once it's uninstalled on OnCall side, so it's
[fixed](https://github.com/grafana/oncall/pull/4559/files#diff-1784f1d0d65fa477f4562e73aa23fe1c757b171f36e03f12600bdb021f121307R577)
as well.
Changes are validated locally.
2024-06-21 06:40:34 +00:00
Vadim Stepanov
b7dbb2a26e
Support message shortcut broadcast (#4518)
# What this PR does

Related to https://github.com/grafana/oncall-gateway/issues/206

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-06-17 10:31:43 +00:00
Joey Orlando
49d20f1a7e
bump uwsgi to 2.0.26 + Python to 3.12.3 (#4495)
# What this PR does

- bumps `uwsgi` to latest version (`2.0.26`), which unblocks us from
bumping Python to 3.12
- bumps Python to 3.12.3
- refactor the Snyk GitHub Actions workflow to use the composable
actions for installed frontend and backend dependencies
- fixes several `AttributeError`s in our tests that went from a warning
to an error in Python 3.12 (see
https://github.com/python/cpython/issues/100690)

# Which issue(s) this PR closes

Closes #4358
Closes https://github.com/grafana/oncall/issues/4387
2024-06-10 15:33:37 -04:00
Ildar Iskhakov
a9ff1cbc33
Handle SlackAPIRatelimitError in perform_notification (#4486)
# What this PR does

Fixes retrying perform_notification task when Slack API returns 429
(Ratelimited)
See
[thread](https://raintank-corp.slack.com/archives/C025VMT6SPK/p1717725432075029)
for more details

## Which issue(s) this PR closes

Closes [issue link here]

<!--
*Note*: if you have more than one GitHub issue that this PR closes, be
sure to preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-06-07 13:54:45 +00:00
Vadim Stepanov
f47f9c29fd
Update resolution note message shortcut instruction (#4482)
# What this PR does

Updates the instruction that pops up when clicking the `Add Resolution
notes` button in Slack with an up-to-date GIF.

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-06-07 13:54:45 +00:00
Innokentii Konstantinov
805d4421bd
Support grafana escalate (#4453)
# What this PR does
This PR adds support for **/grafana escalate** command alongside with
**/escalate.**
2024-06-05 05:51:26 +00:00
Vadim Stepanov
b3a56cdffc
Reduce size of payload on /escalate Slack command (#4458) 2024-06-04 18:11:15 +00:00
Innokentii Konstantinov
17f448c506
Prepare OnCall for Unified Slack App (#4232)
This PR does a bunch of changes to prepare OnCall for Unified Slack App:
1. Install Slack via Chatops-Proxy. This change contains two parts:
getting a Slack install link from chatops-proxy
([code](https://github.com/grafana/oncall/pull/4232/files#diff-437a77d49fc04b92d315651b3df5991000b1ab74cf60aabb21aa77cb2823bf52R46))
and receiving a "slack installed" event from chatops-proxy
([code](https://github.com/grafana/oncall/pull/4232/files#diff-976d106f0962be5c1de5e35582193f68435ed0c17f2defd6bd2857bf6e27f65d)).
Also it means that OnCall doesn't need to register slack_links anymore
when slack is connected/disconnected. These changes are behind
UNIFIED_SLACK_APP_ENABLED flag and should be no-op if flag is not
enabled.
2. Get rid of Multiregionatily restrictions - instrument all slack
interactions with a ProxyMeta - json data telling chatops-proxy where to
route the interaction. Note, that it doesn't apply for "Add to
resolution notes" message action - it will be handled differently in
following PR.
3. Move all chatops-proxy related stuff from common/oncall-gateway to
apps/chatops-proxy

Minor changes:
1. Remove usage of **CHATOPS_V3** flag. Chatops v3 is already released
(It's a refactoring from previous quarter)

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2024-06-03 09:07:10 +00:00
Matias Bordese
5291feeb51
Fix update slack group to not raise if group is not found (#4423)
Fixes https://github.com/grafana/oncall-private/issues/2664
2024-05-30 11:27:25 +00:00
Matias Bordese
6acbb71fad
Do not retry on SlackAPICantUpdateMessageError errors (#4405)
Related to https://github.com/grafana/oncall/pull/4329
2024-05-28 17:46:15 +00:00
Matias Bordese
d4ba57b68b
Avoid retrying to update Slack log message if cant_update_message (#4329)
Do not retry updating a message if Slack returns `cant_update_message`
API [error](https://api.slack.com/methods/chat.update#errors) (meaning
bot user has no permission to update the message).
2024-05-09 16:16:53 +00:00
Salvatore Giordano
720bcf983a
Update deep link URL for Slack messages (#4317)
# What this PR does

It updates the slack deep link url to respect the [correct
format](https://api.slack.com/reference/deep-linking#app_or_bot)
requested [here](https://github.com/grafana/oncall/issues/4122)

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2024-05-09 10:18:48 +00:00
Matias Bordese
b3c1800f87
Add Slack deep link entry to alert group permalinks (#4205)
Related to https://github.com/grafana/oncall/issues/4122
2024-04-12 13:25:48 +00:00
Matias Bordese
4ac2df19b5
Update xdist load to use loadscope setting (#4187)
Changed xdist dist setting to use `loadscope` value
See
[docs](https://pytest-xdist.readthedocs.io/en/latest/distribution.html#running-tests-across-multiple-cpus)
2024-04-08 19:03:58 +00:00
Matias Bordese
398b09a85b
Allow getting details from connected integration webhooks (#4153)
Related to https://github.com/grafana/oncall-private/issues/2615
2024-04-08 14:13:17 +00:00
Matias Bordese
dc9dc9a57f
Update backsync method to take source channel as param (#4159)
Update by backsync will now expect the source alert receive channel
triggering the transition (and update the log record using this
information).

Related to https://github.com/grafana/oncall-private/issues/2615
2024-04-05 16:04:13 +00:00
Innokentii Konstantinov
8294ab5639
Add more logs for updating slack user group members (#4146) 2024-04-03 08:28:22 +00:00
Joey Orlando
afc688feda
upgrade flake8 to v7 (#4141)
# Which issue(s) this PR closes

Fixes [this
issue](https://github.com/grafana/oncall-private/pull/2620/files#diff-0144920543fd191db13f76c9fb797116e26eda2bdd2b79332b61bfbf5846208eR193-R197)
(https://github.com/PyCQA/pycodestyle/issues/334#issuecomment-2027394413)
in `grafana/oncall-private`

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-04-02 14:26:19 +00:00
Joey Orlando
c5cd675738
cleanup CustomButton backend code + add ngrok/express outgoing webhook e2e test (#2544)
# What this PR does

- removes unused "custom button" backend code now that we've migrated to
outgoing webhooks
- adds new e2e test for webhooks asserting that an `ngrok`/`express`
webhook handler receives the call as expected + payload is as expected
(related to https://github.com/grafana/oncall/issues/2691) - skipped for
now, the test passes locally but fails on GitHub Actions CI, seems to be
networking related
 
## Checklist

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

---------

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
2024-03-28 15:37:22 +00:00
Yulya Artyukhina
3c93375244
Update alert group state by backsync (#4089)
# What this PR does
Adds method to update alert group state by backsync
Related to https://github.com/grafana/oncall-private/issues/2542
Should be merged with
https://github.com/grafana/oncall-private/pull/2606

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-03-27 12:37:01 +00:00
Matias Bordese
adaab1c6ad
Check for permissions on Slack escalate command (#3891)
Related to https://github.com/grafana/oncall/issues/3109

Fixes issue from https://github.com/grafana/oncall/pull/3881 (problem
was that there is no organization set in the Slack request, making it
impossible to check for user permissions; check permission once an
organization is set in the form instead).
2024-02-14 19:02:09 +00:00
Matias Bordese
5ecdc26b0a
Revert requiring permission on Slack direct paging (#3881)
Reverting part of https://github.com/grafana/oncall/pull/3861
2024-02-12 18:48:43 +00:00
Matias Bordese
160d501bbe
Add permission checks for Slack paging and shift swaps actions (#3861)
Fixes https://github.com/grafana/oncall/issues/3109
2024-02-09 12:30:05 +00:00
Joey Orlando
7db7b09c55
attempt to address some SlackAPIRatelimitError exceptions (#3820)
# Which issue(s) this PR fixes

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

Attempts to address some `SlackAPIRatelimitError` exceptions seen in the
following tasks:
- `apps.slack.tasks.post_slack_rate_limit_message`
([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22qhs%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%23%20%7Bcluster%3D~%5C%22prod-%28us-central-0%7Ceu-west-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22,%20job%3D~%5C%22amixr-prod%2Famixr-engine-celery-retry%2A%5C%22%7D%5Cn%7Bcluster%3D~%5C%22prod-%28us-central-0%7Ceu-west-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%5C%22apps.slack.tasks.post_slack_rate_limit_message%5C%22%20%7C%3D%20%5C%22retry%5C%22%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22000000193%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-7d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1))
- `alerts.tasks.notify_user.perform_notification`
([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22qhs%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bcluster%3D~%5C%22prod-%28us-central-0%7Ceu-west-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%5C%22SlackAPIRatelimitError%5C%22%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22000000193%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-7d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1))

## 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)
2024-02-01 14:47:12 -05:00
Michael Derynck
2a466a0c4f
Add transaction on_commit before signals for alert group actions (#3731)
# What this PR does
Add transactions around log record creation and check transaction
on_commit before sending signals passing DB id of alert group log
records. In cases for delete we can then assume any missing IDs on tasks
are from intentionally deleted alert groups and we can stop tasks from
retrying endlessly.

## Which issue(s) this PR fixes

## 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)
2024-01-31 15:54:50 -07:00
Joey Orlando
758c12790d
fix slack API rate limit errors in send_message_to_thread_if_bot_not_in_channel task (#3803)
# What this PR does

See [this
conversation](https://raintank-corp.slack.com/archives/C04JCU51NF8/p1706722752735009)
for more context.

Additionally, improves logging for this task + adds unit 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)
2024-01-31 13:42:52 -05:00