Skip to content

Commit

Permalink
v1.3.110
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyorlando authored Mar 7, 2024
2 parents bc64409 + 99cd4c1 commit 81246d9
Show file tree
Hide file tree
Showing 124 changed files with 2,119 additions and 1,914 deletions.
5 changes: 0 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
* @grafana/grafana-oncall-backend

# don't tag @grafana/grafana-oncall-backend on changes to CHANGELOG.md
CHANGELOG.md

/grafana-plugin @grafana/grafana-oncall-frontend

/docs @grafana/docs-gops

# `make docs` procedure is owned by @jdbaldry of @grafana/docs-squad.
Expand Down
11 changes: 9 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# What this PR does

## Which issue(s) this PR fixes
## 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)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` 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.
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changelog:
exclude:
labels:
- release:ignore
categories:
- title: Breaking Changes 🛠
labels:
- release:breaking-change
- title: Exciting New Features 🎉
labels:
- release:enhancement
- title: Other Changes
labels:
- release:patch
12 changes: 7 additions & 5 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ name: e2e tests
required: true
type: boolean
secrets:
# NOTE: these are only required for the "expensive" e2e tests, which are only run via
# a daily GitHub Actions cron job (see .github/workflows/daily-e2e-tests.yml)
TWILIO_ACCOUNT_SID:
required: true
required: false
TWILIO_AUTH_TOKEN:
required: true
required: false
TWILIO_PHONE_NUMBER:
required: true
required: false
TWILIO_VERIFY_SID:
required: true
required: false
MAILSLURP_API_KEY:
required: true
required: false

jobs:
end-to-end-tests:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/linting-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,3 @@ jobs:
# grafana-image-tag: 10.3.3
run-expensive-tests: false
browsers: "chromium"
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/on-issue-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ jobs:
${{ contains(steps.issue-form-values.outputs.issueparser_product_area, 'Mobile App') && 'part:mobile' || '' }}
${{ contains(steps.issue-form-values.outputs.issueparser_product_area, 'Schedules') && 'part:schedules' || '' }}
${{ contains(steps.issue-form-values.outputs.issueparser_product_area, 'Terraform') && 'part:API/Terraform' || '' }}
${{ contains(steps.issue-form-values.outputs.issueparser_product_area, 'Other') && 'no info or need to discuss' || '' }}
${{ contains(steps.issue-form-values.outputs.issueparser_product_area, 'Other') && 'more info needed' || '' }}
# yamllint enable rule:line-length
23 changes: 0 additions & 23 deletions .github/workflows/verify-changelog-updated.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/verify-release-label-added.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Verify Release Label Added

"on":
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
branches:
- dev
# tldr; without this here we cannot have the "Verify Release Label Added" job as a required status check to
# pass before merging
#
# It allows this to run for jobs in the merge_queue such that we can have the "Verify Release Label Added" job
# as a required status check to pass before merging. However, it seems like this action doesn't run properly
# on jobs triggerd by the merge_group event
# (see here for example https://github.com/grafana/oncall/actions/runs/8176552748/job/22356224259#step:3:9)
# so we'll check the event type and skip if that is the case
merge_group:

jobs:
verify-release-label-added:
# see comment above
if: github.event_name == 'pull_request'
name: Verify Release Label Added
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
prefix_mode: true
one_of: "release:"
repo_token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

*NOTE*: for all future release notes, please see the [Releases page](https://github.com/grafana/oncall/releases).

## v1.3.109 (2024-03-04)

### Fixed
Expand Down Expand Up @@ -994,7 +996,7 @@ Minor bugfixes + dependency updates :)

- Bring heartbeats back to UI by @maskin25 ([#2550](https://github.com/grafana/oncall/pull/2550))
- Address issue when Grafana feature flags which were enabled via the `feature_flags.enabled` were only properly being
parsed, when they were space-delimited. This fix allows them to be _either_ space or comma-delimited.
parsed, when they were space-delimited. This fix allows them to be *either* space or comma-delimited.
by @joeyorlando ([#2623](https://github.com/grafana/oncall/pull/2623))

## v1.3.16 (2023-07-21)
Expand Down Expand Up @@ -1176,7 +1178,7 @@ Minor bugfixes + dependency updates :)
- Change OnCall plugin to use service accounts and api tokens for communicating with backend, by @mderynck ([#2385](https://github.com/grafana/oncall/pull/2385))
- RabbitMQ Docker image upgraded from 3.7.19 to 3.12.0 in `docker-compose-developer.yml` and
`docker-compose-mysql-rabbitmq.yml`. **Note**: if you use one of these config files for your deployment
you _may_ need to follow the RabbitMQ "upgrade steps" listed [here](https://rabbitmq.com/upgrade.html#rabbitmq-version-upgradability)
you *may* need to follow the RabbitMQ "upgrade steps" listed [here](https://rabbitmq.com/upgrade.html#rabbitmq-version-upgradability)
by @joeyorlando ([#2359](https://github.com/grafana/oncall/pull/2359))

### Fixed
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ info on updating Grafana plugins.
## Join community
[<img width="200px" src="docs/img/community_call.png">](https://github.com/grafana/oncall/discussions/categories/community-calls)
[<img width="200px" src="docs/img/GH_discussions.png">](https://github.com/grafana/oncall/discussions)
[<img width="200px" src="docs/img/slack.png">](https://slack.grafana.com/)
[<img width="200px" src="docs/img/GH_discussions.png">](https://community.grafana.com/)
Have a question, comment or feedback? Don't be afraid to [open an issue](https://github.com/grafana/oncall/issues/new/choose)!

## Stargazers over time

Expand Down
3 changes: 3 additions & 0 deletions docs/sources/integrations/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ to the heartbeat endpoint. If OnCall doesn't receive one of these alerts, it wil
1. Set **Heartbeat interval**
1. Copy **Endpoint** into you monitoring system.

If you need to disable heartbeat monitoring on an integration use the **Reset** button to return it to the state of being
inactive. To start the heartbeat monitoring again send a request to the **Endpoint**.

More specific instructions can be found in a specific integration's documentation.

#### Behaviour and rendering templates example
Expand Down
6 changes: 3 additions & 3 deletions docs/sources/integrations/inbound-email/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Inbound Email integration will consume emails from dedicated email address and m

## Configure required environment variables

Refer to [Inbound Email Setup][] for details.
Refer to [Inbound Email Setup] for details.

## Configure Inbound Email integration for Grafana OnCall

Expand Down Expand Up @@ -47,6 +47,6 @@ Alerts from Inbound Email integration have the following payload:
[jinja2-templating]: "/docs/oncall/ -> /docs/oncall/<ONCALL_VERSION>/configure/jinja2-templating"
[jinja2-templating]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/alerting-and-irm/oncall/configure/jinja2-templating"

[Inbound Email Setup]: "/docs/oncall/ -> /docs/oncall/<ONCALL_VERSION>/set-up/open-source#inbound-email-setup)
[Inbound Email Setup]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/alerting-and-irm/oncall/set-up/open-source#inbound-email-setup)
[Inbound Email Setup]: "/docs/oncall/ -> /docs/oncall/<ONCALL_VERSION>/set-up/open-source#inbound-email-setup"
[Inbound Email Setup]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/alerting-and-irm/oncall/set-up/open-source#inbound-email-setup"
{{% /docs/reference %}}
6 changes: 6 additions & 0 deletions docs/sources/manage/notify/slack/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ For Open Source Grafana OnCall Slack installation guidance, refer to [Slack setu
1. Provide your Slack workspace URL and sign with your Slack credentials.
1. Click **Allow** to give Grafana OnCall permission to access your Slack workspace.

### Configure timeout for acknowledged alerts

You can configure reminders for acknowledged alerts in the Additional settings section of the Chat Ops tab.
This section allows you to enable reminders to be sent through Slack at set intervals. You can also choose to have an
alert group revert to unacknowledged after a designated period of time if the reminder is not confirmed.

## Why does OnCall Slack App require so many permissions?

OnCall has an advanced Slack App with dozens of features making it even possible for users to be on-call and work with
Expand Down
3 changes: 2 additions & 1 deletion docs/sources/oncall-api-reference/alertgroups.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ The above command returns JSON structured in the following way:
"permalinks": {
"slack": "https://ghostbusters.slack.com/archives/C1H9RESGA/p135854651500008",
"telegram": "https://t.me/c/5354/1234?thread=1234"
}
},
"silenced_at": "2020-05-19T13:37:01.429805Z",
}
],
"current_page_number": 1,
Expand Down
25 changes: 17 additions & 8 deletions engine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
FROM python:3.11.4-alpine3.18 AS base
ARG TARGETPLATFORM

# Create a group and user to run an app
ENV APP_USER=appuser
RUN addgroup --system --gid 2000 ${APP_USER} && \
adduser --system --uid 1000 --ingroup ${APP_USER} ${APP_USER}

RUN apk add bash \
python3-dev \
build-base \
linux-headers \
pcre-dev \
mariadb-connector-c-dev \
libffi-dev \
git \
postgresql-dev
python3-dev \
build-base \
linux-headers \
pcre-dev \
mariadb-connector-c-dev \
libffi-dev \
git \
postgresql-dev

WORKDIR /etc/app
COPY ./requirements.txt ./
COPY ./grpcio-1.57.0-cp311-cp311-linux_aarch64.whl ./

# grpcio is not available for arm64 on pypi, so we need to install it from a local wheel
# this can be removed once https://github.com/grpc/grpc/issues/34998 is resolved
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
pip install grpcio-1.57.0-cp311-cp311-linux_aarch64.whl \
&& rm grpcio-1.57.0-cp311-cp311-linux_aarch64.whl; \
fi

# TODO: figure out how to get this to work.. see comment in .github/workflows/e2e-tests.yml
# https://stackoverflow.com/a/71846527
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ def _get_buttons_blocks(self):
resolution_notes_button["text"]["text"] = "Add Resolution notes"
buttons.append(resolution_notes_button)

# Declare Incident button
# Declare incident button
if self.alert_group.channel.organization.is_grafana_incident_enabled:
incident_button = {
"type": "button",
"text": {"type": "plain_text", "text": ":fire: Declare Incident", "emoji": True},
"text": {"type": "plain_text", "text": ":fire: Declare incident", "emoji": True},
"value": "declare_incident",
"url": self.alert_group.declare_incident_link,
"action_id": ScenarioStep.get_step("declare_incident", "DeclareIncidentStep").routing_uid(),
Expand Down
12 changes: 8 additions & 4 deletions engine/apps/api/serializers/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def to_internal_value(self, data):
data["password"] = webhook.password
if data.get("authorization_header") == WEBHOOK_FIELD_PLACEHOLDER:
data["authorization_header"] = webhook.authorization_header

if not data.get("integration_filter"):
data["integration_filter"] = []

return super().to_internal_value(data)

def _validate_template_field(self, template):
Expand Down Expand Up @@ -185,13 +189,13 @@ def validate_preset(self, preset):
for controlled_field in preset_metadata.controlled_fields:
if controlled_field in self.initial_data:
if self.instance:
if self.initial_data[controlled_field] is not None and self.initial_data[
controlled_field
] != getattr(self.instance, controlled_field):
if bool(self.initial_data[controlled_field]) and self.initial_data[controlled_field] != getattr(
self.instance, controlled_field
):
raise serializers.ValidationError(
detail=f"{controlled_field} is controlled by preset, cannot update"
)
elif self.initial_data[controlled_field] is not None:
elif bool(self.initial_data[controlled_field]):
raise serializers.ValidationError(
detail=f"{controlled_field} is controlled by preset, cannot create"
)
Expand Down
23 changes: 23 additions & 0 deletions engine/apps/api/tests/test_integration_heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,29 @@ def test_update_integration_heartbeat(
assert updated_instance.timeout_seconds == 600


@pytest.mark.django_db
def test_reset_integration_heartbeat(
integration_heartbeat_internal_api_setup,
make_user_auth_headers,
):
user, token, alert_receive_channel, integration_heartbeat = integration_heartbeat_internal_api_setup
last_updated = timezone.now()
integration_heartbeat.last_heartbeat_time = last_updated
integration_heartbeat.save()
heartbeat_before_reset = IntegrationHeartBeat.objects.get(
public_primary_key=integration_heartbeat.public_primary_key
)
assert heartbeat_before_reset.last_heartbeat_time == last_updated

client = APIClient()
url = reverse("api-internal:integration_heartbeat-reset", kwargs={"pk": integration_heartbeat.public_primary_key})

response = client.post(url, **make_user_auth_headers(user, token))
reset_instance = IntegrationHeartBeat.objects.get(public_primary_key=integration_heartbeat.public_primary_key)
assert response.status_code == status.HTTP_204_NO_CONTENT
assert reset_instance.last_heartbeat_time is None


@pytest.mark.django_db
@pytest.mark.parametrize(
"role,expected_status",
Expand Down
18 changes: 18 additions & 0 deletions engine/apps/api/tests/test_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,24 @@ def test_webhook_integration_filter(webhook_internal_api_setup, make_alert_recei
assert list(webhook.filtered_integrations.all()) == []
assert response.json()["integration_filter"] == []

# clear filter also works if set to None
url = reverse("api-internal:webhooks-detail", kwargs={"pk": webhook.public_primary_key})
data = {
"name": "github_button_updated",
"url": "https://github.com/",
"trigger_type": Webhook.TRIGGER_ALERT_GROUP_CREATED,
"http_method": "POST",
"team": None,
"integration_filter": None,
}
response = client.put(
url, data=json.dumps(data), content_type="application/json", **make_user_auth_headers(user, token)
)
webhook.refresh_from_db()
assert response.status_code == status.HTTP_200_OK
assert list(webhook.filtered_integrations.all()) == []
assert response.json()["integration_filter"] == []


@pytest.mark.django_db
@pytest.mark.parametrize(
Expand Down
12 changes: 9 additions & 3 deletions engine/apps/api/views/integration_heartbeat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from rest_framework import mixins, viewsets
from rest_framework import mixins, status, viewsets
from rest_framework.decorators import action
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
Expand Down Expand Up @@ -30,8 +30,7 @@ class IntegrationHeartBeatView(
"create": [RBACPermission.Permissions.INTEGRATIONS_WRITE],
"update": [RBACPermission.Permissions.INTEGRATIONS_WRITE],
"partial_update": [RBACPermission.Permissions.INTEGRATIONS_WRITE],
"activate": [RBACPermission.Permissions.INTEGRATIONS_WRITE],
"deactivate": [RBACPermission.Permissions.INTEGRATIONS_WRITE],
"reset": [RBACPermission.Permissions.INTEGRATIONS_WRITE],
}

model = IntegrationHeartBeat
Expand Down Expand Up @@ -74,6 +73,13 @@ def perform_update(self, serializer):
new_state=new_state,
)

@action(detail=True, methods=["post"])
def reset(self, request, pk):
instance = self.get_object()
instance.last_heartbeat_time = None
instance.save()
return Response(status=status.HTTP_204_NO_CONTENT)

@action(detail=False, methods=["get"])
def timeout_options(self, request):
choices = []
Expand Down
Loading

0 comments on commit 81246d9

Please sign in to comment.