Commit graph

1543 commits

Author SHA1 Message Date
Vadim Stepanov
cd770e85ea
Catch DoesNotExist in post_slack_rate_limit_message (#1067) 2023-01-03 17:44:56 +00:00
Ildar Iskhakov
da51edefcc
Update CHANGELOG.md 2023-01-03 21:50:53 +08:00
Ildar Iskhakov
4a32b21c46
Update CHANGELOG.md 2023-01-03 21:09:00 +08:00
Ildar Iskhakov
d778710469
Update CHANGELOG.md 2023-01-03 21:07:36 +08:00
Joey Orlando
25998103cc
swap psycopg2-binary to psycopg2 in requirements.txt (#1062)
Fixes issue when running OnCall locally, on an M1 Mac, and using
PostgreSQL as the database. (ie. `COMPOSE_PROFILES=postgres...`).
Currently getting:
```bash
django.db.utils.OperationalError: SCRAM authentication requires libpq version 10 or above
```

I also tried simply adding `libpq-dev` to the `Dockerfile` but this
change alone does not solve the issue. See
[here](https://github.com/MobSF/Mobile-Security-Framework-MobSF/issues/1898)
for a similar reported issue on GitHub.

**Root Cause**
This issue is caused because `psycopg2-binary` 2.9.3 [doesn't
provide](https://pypi.org/project/psycopg2-binary/2.9.3/#files) binary
wheels for MacOS arm64; binary wheels for MacOS are only provided for
Intel x86 64 bits
([reference](https://stackoverflow.com/a/71653850/3902555)).
2023-01-03 13:47:03 +01:00
Matias Bordese
05524ab698
Merge pull request #1059 from grafana/matiasb/truncate-slack-title-block
Truncate slack alert group title block below max size
2023-01-03 08:50:57 -03:00
Matias Bordese
0a3c96d3c3
Merge pull request #1058 from grafana/matias/fix-schedule-no-start-byday
Handle no start date when calculating by day ical shift events
2023-01-03 08:50:27 -03:00
Ildar Iskhakov
100a18ab1c
Update CHANGELOG.md 2023-01-03 19:46:12 +08:00
Joey Orlando
78c10cf0ca
bump crptography version (#1061)
## Which issue(s) this PR fixes
This change fixes the following issue:
```bash
Traceback (most recent call last):
  File "/etc/app/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 75, in handle
    self.check(databases=[database])
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 419, in check
    all_issues = checks.run_checks(
  File "/usr/local/lib/python3.9/site-packages/django/core/checks/registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/usr/local/lib/python3.9/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/local/lib/python3.9/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/usr/local/lib/python3.9/site-packages/django/urls/resolvers.py", line 416, in check
    for pattern in self.url_patterns:
  File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.9/site-packages/django/urls/resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.9/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/etc/app/extensions/engine_enterprise/engine_enterprise/engine_enterprise_urls.py", line 2, in <module>
    from engine.urls import urlpatterns
  File "/etc/app/engine/urls.py", line 36, in <module>
    path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")),
  File "/usr/local/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/etc/app/apps/integrations/urls.py", line 5, in <module>
    from .views import (
  File "/etc/app/apps/integrations/views.py", line 14, in <module>
    from django_sns_view.views import SNSEndpoint
  File "/usr/local/lib/python3.9/site-packages/django_sns_view/views.py", line 17, in <module>
    from django_sns_view.utils import confirm_subscription, verify_notification
  File "/usr/local/lib/python3.9/site-packages/django_sns_view/utils.py", line 6, in <module>
    import pem
  File "/usr/local/lib/python3.9/site-packages/pem/__init__.py", line 26, in <module>
    from . import twisted
  File "/usr/local/lib/python3.9/site-packages/pem/twisted.py", line 9, in <module>
    from OpenSSL.SSL import FILETYPE_PEM
  File "/usr/local/lib/python3.9/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python3.9/site-packages/OpenSSL/crypto.py", line 3279, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
```
2023-01-03 10:08:00 +01:00
Ildar Iskhakov
1ff0a7da99
1.1.5.5 -> dev (#1060)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

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

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
Co-authored-by: Julia <ferril.darkdiver@gmail.com>
Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
2023-01-03 11:57:16 +08:00
Innokentii Konstantinov
5e297847ae Speedup alert group search 2023-01-03 11:04:16 +08:00
Matias Bordese
374f32f489 Handle no start date when calculating by day ical shift events 2023-01-02 11:53:49 -03:00
Matias Bordese
75aaeef3f2 Truncate slack alert group title block below max size 2023-01-02 10:07:53 -03:00
Vadim Stepanov
9ebf20c488
Make user matching by email case-insensitive for PD migrator (#1056)
https://github.com/grafana/oncall/issues/1025
2022-12-30 16:11:35 +00:00
Vadim Stepanov
1b67a8ec68
Add PD migrator lint & test steps to CI (#1053)
# What this PR does

- Add PD migrator related hooks to `.pre-commit-config.yaml`
- Add Github Actions step for running PD migrator tests
2022-12-30 16:03:39 +00:00
Ildar Iskhakov
282e58db7b
Don't render logs for too big telegram dm (#1051)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2022-12-29 13:22:15 +00:00
Joey Orlando
d1a43bdf1b
specify Firebase GCP project id (#1042)
Modifies the Firebase app initialization to explicitly specify the GCP
project ID where the Firebase app is. Previously it would use the
project associated with the service account being used.
2022-12-22 21:44:53 +01:00
Joey Orlando
e1b798d586
add curl and bash to oncall engine docker image (#1034)
Currently unable to exec into a k8s pod. I believe this is because
`bash` is missing from the Docker image after switching from alpine to
debian buster. Debugging this by adding in `bash`.
2022-12-21 18:23:16 +01:00
Ieva
e1b9a75ce7
RBAC: update RBAC permissions scopes for plugins.app:access action (#1028)
Change RBAC permission scope to `plugins🆔grafana-oncall-app` from
`plugins.app🆔grafana-oncall-app` for permissions with
`plugins.app:access` action. This is needed because [Grafana is
expecting](https://github.com/grafana/grafana/blob/main/pkg/services/accesscontrol/pluginutils/utils.go#L20-L21)
`plugins:` not `plugins.app` prefix for permissions with
`plugins.app:access` action.
2022-12-20 18:15:18 +01:00
Juris Pavļučenkovs
327b7121ac
Helm: define engine update strategy in values.yaml (#985)
# What this PR does

Now it is possible to change engine deployment update strategy in
values.yaml.
## Which issue(s) this PR fixes

This is due to #334 and #316, as with rolling update, race conditions
might happen when there is still an old engine pod running.

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2022-12-20 13:59:19 +01:00
Joey Orlando
7ebc9cbbf7
modify push notification settings + use fcm-django library (#998)
- swaps out `django-push-notifications` for
[`fcm-django`](https://github.com/grafana/fcm-django). Again.. this is a
fork of the parent repo for exactly the same reason.. the migrations
point to `auth_user` without letting us use our own user model, this has
been patched in the `grafana` fork. The reason why we are using
`fcm-django` vs `django-push-notifications` is that the latter does not
support the new FCM API, only the "legacy" API. The legacy FCM API does
not support certain push notification settings that we would like to
use.
- modifies the iOS/Android specific push notification settings
- adds a `flower` pod in the `docker-compose-developer.yml`, useful for
debugging tasks locally
- sets the mobile app verification token TTL to 5 minutes when
developing locally. The default of 1 minute makes working with device
emulators really tricky..

This PR also swaps out the base image in `engine/Dockerfile` from
`python:3.9-alpine3.16` to `python:3.9-slim-buster`.

As to why.. in short, with the introduction of the `fcm-django` library
there is now a peer-dependency on
[`grpcio`](https://github.com/grpc/grpc) (which is used by
`firebase_admin`.. which I am using in this PR to interact directly with
Firebase Cloud Messaging (FCM)). `grpcio` does not publish wheels (read:
compiled binaries) for the Alpine distro. It does publish wheels for
Debian and hence `pip install -r requirements.txt` does not need to
build this library from the source distribution.

This is a [known
"issue"](https://github.com/grpc/grpc/issues/22815#issuecomment-1107874367)
and the recommended solution in the community is to.. not use alpine.

These were the numbers, when building the image locally, in terms of
image size and build time:

| | Local image size (uncompressed | Build time (may differ based on
your network speed) |
| ------------------------- | -------------------------------------- |
---------- |
| `python:3.9-alpine3.16`   | 785MB  | 320s |
| `python:3.9-slim-buster` | 1.05GB  | 90s   |

Co-authored-by: Salvatore Giordano <salvatoregiordanoo@gmail.com>
2022-12-20 12:41:34 +01:00
Rares Mardare
5595480d3a
add qr code class with white background (#1012)
# What this PR does

- Adds white border around the QR code + small margin below
2022-12-19 14:15:32 +03:00
Innokentii Konstantinov
7bb4fdfe43
Merge pull request #1017 from grafana/fix_ag_filtering
Speedup search alertgroup to group alert
2022-12-19 10:59:24 +08:00
Innokentii Konstantinov
41f886b31e Speedup seach alertgroup 2022-12-17 19:34:13 +08:00
Matvey Kukuy
275aa94c71
Small wording fix (Incident -> AG) (#1009)
Small wording fix (Incident -> AG)
2022-12-16 17:23:21 +02:00
Gilberto Junior
f16c4b26c6
Increasing library default timeout (#1005)
# What this PR does

## Which issue(s) this PR fixes

Issues: https://github.com/grafana/oncall/issues/990

## Checklist

- [X] Tests updated
2022-12-16 13:09:04 +02:00
Joey Orlando
ed4be171f6
add make command to configure mobile app feature (#988)
Adds a make command, `enable-mobile-app-feature-flags`, which sets the
backend feature flag in `./dev/.env.dev`, and updates a record in the
`base_dynamicsetting` database table, which are needed to enable the
mobile app backend features.
2022-12-14 09:36:35 +01:00
Matias Bordese
2b763f376e
Update CHANGELOG.md 2022-12-13 10:18:18 -03:00
Matias Bordese
684375a3eb
Update CHANGELOG.md 2022-12-13 10:16:59 -03:00
Joey Orlando
66b2ed5c64
add more logging to push notification celery task (#986) 2022-12-13 14:06:56 +01:00
Joey Orlando
5967d5af63
remove apns + fix django-push-notifications migrations (#984)
- removes APNS support
- changes the `django-push-notification` library from the `iskhakov`
fork to the [`grafana`
fork](https://github.com/grafana/django-push-notifications). This new
fork basically just patches an issue which affected the database
migrations of this django app (previously the library would not respect
the `USER_MODEL` setting when creating its tables and would instead
reference the `auth_user` table.. which we don't want)
- add `--no-cache` flag to the `make build` command

**NOTE**
A migration should be applied as follows:
```bash
# remove the four push_notifications tables, which have improper foreign key references
python manage.py migrate push_notifications zero

# recreate the tables with the proper foreign key references
python manage.py migrate
```
2022-12-13 13:00:59 +01:00
Matias Bordese
d2d73093a8
Merge pull request #980 from grafana/matiasb/fix-schedules-types-ui
Fix schedules types UI confusion
2022-12-12 16:54:18 -03:00
Matias Bordese
b8c77e4b30 Fix schedules types UI confusion 2022-12-12 16:30:24 -03:00
Matias Bordese
ad71fc3d61
Merge pull request #979 from grafana/matiasb/slack-endpoint-extra-logging
Add additional logging info for slack API event endpoint requests
2022-12-12 15:58:10 -03:00
Matias Bordese
9931105cc2 Add additional logging info for slack API event endpoint requests 2022-12-12 15:41:48 -03:00
Joey Orlando
b66dd1a30c
fix sync.. again (#978) 2022-12-12 18:48:26 +01:00
Joey Orlando
3625b75791
fix cloud sync related issue (#977)
this PR reverts [this
change](9e598385f4 (diff-a74aa8f07a8fdc31af66559390f0fc77b66692d43e6d3c5f94311ef7eed5efabL19-L55))
and removes the `str` casting that was done on the `orgId` field
returned from the Grafana COM API
2022-12-12 18:25:56 +01:00
Joey Orlando
8c0eba46b9
remove is_rbac_permissions_enabled logic from check_gcom_permission function (#976)
this field will be addressed in a subsequent sync call it is not
necessary here
2022-12-12 17:05:44 +01:00
Michael Derynck
52d6009c2a
Remove unused parameter from gcom call (#975)
# What this PR does
Remove unused parameter from gcom call

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2022-12-12 08:40:32 -07:00
Matias Bordese
5036d719d7
Update CHANGELOG.md 2022-12-09 15:16:33 -03:00
Matias Bordese
41005b06dd
Merge pull request #973 from grafana/matiasb/editors-get-schedule-write
Update SCHEDULES_WRITE fallback role to EDITOR
2022-12-09 14:58:16 -03:00
Matias Bordese
67ac47ff32 Update SCHEDULES_WRITE fallback role to EDITOR 2022-12-09 12:56:35 -03:00
Joey Orlando
635168afb9
hide mobile app verification tab in the user settings modal for unauthed users (#970) 2022-12-09 12:53:20 +01:00
dependabot[bot]
f0b7a0e189 Bump decode-uri-component from 0.2.0 to 0.2.2 in /grafana-plugin
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 10:35:33 +01:00
Rares Mardare
b448451cce
Show mobile tab only if it's feature and the user has permissions (#961)
# What this PR does
- Show/Hide mobile app screen only if user has permission
- Show/Hide mobile app screen only for current user

## Which issue(s) this PR fixes

#926
2022-12-08 10:19:00 +02:00
Innokentii Konstantinov
28dedcd109
Shorten telegram callback data (#959)
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2022-12-07 23:54:29 +08:00
Rares Mardare
01d9333bd4
Merge pull request #956 from grafana/rares/mobileapp-tweaks
Mobile app screen tweaks
2022-12-07 13:51:46 +02:00
Rares Mardare
84f0c48b96 fixed edge case 2022-12-07 13:45:23 +02:00
Rares Mardare
ebc62ab69f added max timeout of 10s to all jest tests for cases when it needs to wait
timeout value
2022-12-07 13:28:42 +02:00
Rares Mardare
d85f16c9f1 more user friendly loader + use own styles rather than overwriting grafana's one 2022-12-07 13:16:03 +02:00