Skip to content

Commit

Permalink
Merge pull request #4837 from grafana/dev
Browse files Browse the repository at this point in the history
v1.9.1
  • Loading branch information
mderynck authored Aug 16, 2024
2 parents d8b4d10 + 06d19bf commit 43a49fc
Show file tree
Hide file tree
Showing 135 changed files with 4,131 additions and 3,538 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* @grafana/grafana-oncall-backend
/grafana-plugin @grafana/grafana-oncall-frontend
/grafana-plugin/pkg @grafana/grafana-oncall-backend
/docs @grafana/docs-gops @grafana/grafana-oncall

# `make docs` procedure is owned by @jdbaldry of @grafana/docs-squad.
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,11 @@ jobs:

# ---------- Expensive e2e tests steps start -----------
- name: Install Go
if: inputs.run-expensive-tests
uses: actions/setup-go@v4
with:
go-version: "1.21.5"

- name: Install Mage
if: inputs.run-expensive-tests
run: go install github.com/magefile/[email protected]

- name: Get Vault secrets
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/linting-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
jobs:
lint-entire-project:
name: "Lint entire project"
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -27,7 +27,7 @@ jobs:

lint-test-and-build-frontend:
name: "Lint, test, and build frontend"
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -39,7 +39,7 @@ jobs:

test-technical-documentation:
name: "Test technical documentation"
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: "Check out code"
uses: "actions/checkout@v4"
Expand All @@ -56,7 +56,7 @@ jobs:
lint-migrations-backend-mysql-rabbitmq:
name: "Lint database migrations"
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
services:
rabbit_test:
image: rabbitmq:3.12.0
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
unit-test-helm-chart:
name: "Helm Chart Unit Tests"
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -99,6 +99,16 @@ jobs:
- name: Run tests
run: helm unittest ./helm/oncall

unit-test-backend-plugin:
name: "Backend Tests: Plugin"
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21.5"
- run: cd grafana-plugin && go test ./pkg/...

unit-test-backend-mysql-rabbitmq:
name: "Backend Tests: MySQL + RabbitMQ (RBAC enabled: ${{ matrix.rbac_enabled }})"
runs-on: ubuntu-latest-16-cores
Expand Down Expand Up @@ -202,7 +212,7 @@ jobs:

unit-test-migrators:
name: "Unit tests - Migrators"
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -216,7 +226,7 @@ jobs:

mypy:
name: "mypy"
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand Down
19 changes: 18 additions & 1 deletion .tilt/plugin/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,21 @@ if not is_ci:
serve_dir=grafana_plugin_dir,
serve_cmd="yarn watch",
allow_parallel=True,
)
)

local_resource(
'build-oncall-plugin-backend',
labels=[label],
dir="../../grafana-plugin",
cmd="mage buildAll",
deps=['../../grafana-plugin/pkg/plugin']
)

local_resource(
'restart-oncall-plugin-backend',
labels=[label],
dir="../../dev/scripts",
cmd="chmod +x ./restart_backend_plugin.sh && ./restart_backend_plugin.sh",
resource_deps=["grafana", "build-oncall-plugin-backend"],
deps=['../../grafana-plugin/pkg/plugin']
)
2 changes: 1 addition & 1 deletion .tilt/tests/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local_resource(
cmd=e2e_tests_cmd,
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=is_ci,
resource_deps=["build-ui", "grafana", "grafana-oncall-app-provisioning-configmap", "engine", "celery"]
resource_deps=["build-ui", "grafana", "grafana-oncall-app-provisioning-configmap", "engine", "celery", "build-oncall-plugin-backend"]
)

cmd_button(
Expand Down
9 changes: 7 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if not running_under_parent_tiltfile:
# Load the custom Grafana extensions
v1alpha1.extension_repo(
name="grafana-tilt-extensions",
ref="v1.2.0",
ref="v1.4.2",
url="https://github.com/grafana/tilt-extensions",
)
v1alpha1.extension(
Expand All @@ -83,6 +83,7 @@ def load_grafana():
# The user/pass that you will login to Grafana with
grafana_admin_user_pass = os.getenv("GRAFANA_ADMIN_USER_PASS", "oncall")
grafana_version = os.getenv("GRAFANA_VERSION", "latest")
grafana_url = os.getenv("GRAFANA_URL", "http://grafana:3000")


if 'plugin' in profiles:
Expand All @@ -100,11 +101,15 @@ def load_grafana():
context="grafana-plugin",
plugin_files=["grafana-plugin/src/plugin.json"],
namespace="default",
deps=["grafana-oncall-app-provisioning-configmap", "build-ui"],
deps=["grafana-oncall-app-provisioning-configmap", "build-ui", "build-oncall-plugin-backend"],
extra_env={
"GF_SECURITY_ADMIN_PASSWORD": "oncall",
"GF_SECURITY_ADMIN_USER": "oncall",
"GF_AUTH_ANONYMOUS_ENABLED": "false",
"GF_APP_URL": grafana_url, # older versions of grafana need this
"GF_SERVER_ROOT_URL": grafana_url,
"GF_FEATURE_TOGGLES_ENABLE": "externalServiceAccounts",
"ONCALL_API_URL": "http://oncall-dev-engine:8080"
},
)
# --- GRAFANA END ----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ apps:
jsonData:
stackId: 5
orgId: 100
onCallApiUrl: http://oncall-dev-engine:8080
onCallApiUrl: $ONCALL_API_URL
2 changes: 1 addition & 1 deletion dev/helm-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ grafana:
- name: DATABASE_PASSWORD
value: oncallpassword
env:
GF_FEATURE_TOGGLES_ENABLE: topnav
GF_FEATURE_TOGGLES_ENABLE: topnav,externalServiceAccounts
GF_SECURITY_ADMIN_PASSWORD: oncall
GF_SECURITY_ADMIN_USER: oncall
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-oncall-app
Expand Down
23 changes: 23 additions & 0 deletions dev/scripts/restart_backend_plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Find a grafana pod
pod=$(kubectl get pods -l app.kubernetes.io/name=grafana -o=jsonpath='{.items[0].metadata.name}')

if [ -z "$pod" ]; then
echo "No pod found with the specified label."
exit 1
fi

# Exec into the pod
kubectl exec -it "$pod" -- /bin/bash <<'EOF'
# Find and kill the process containing "gpx_grafana" (plugin backend process)
process_id=$(ps aux | grep gpx_grafana | grep -v grep | awk '{print $1}')
echo $process_id
if [ -n "$process_id" ]; then
echo "Killing process $process_id"
kill $process_id
else
echo "No process containing 'gpx_grafana' in COMMAND found."
fi
EOF
4 changes: 2 additions & 2 deletions docker-compose-developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ services:
context: ./grafana-plugin
dockerfile: Dockerfile.dev
labels: *oncall-labels
environment:
ONCALL_API_URL: http://host.docker.internal:8080
volumes:
- ./grafana-plugin:/etc/app
- node_modules_dev:/etc/app/node_modules
Expand Down Expand Up @@ -324,6 +322,8 @@ services:
GF_SECURITY_ADMIN_USER: oncall
GF_SECURITY_ADMIN_PASSWORD: oncall
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-oncall-app
GF_FEATURE_TOGGLES_ENABLE: externalServiceAccounts
ONCALL_API_URL: http://host.docker.internal:8080
env_file:
- ./dev/.env.${DB}.dev
ports:
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Grafana OnCall HTTP API reference
menuTitle: API reference
description: Reference material for Grafana OnCall API.
weight: 900
weight: 0
keywords:
- OnCall
- API
Expand Down
13 changes: 8 additions & 5 deletions docs/sources/oncall-api-reference/alertgroups.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/alertgroups/
title: Alert groups HTTP API
weight: 400
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down Expand Up @@ -58,10 +58,13 @@ The above command returns JSON structured in the following way:
These available filter parameters should be provided as `GET` arguments:

- `id`
- `route_id`
- `integration_id`
- `state`
- `id` (Exact match, alert group ID)
- `route_id` (Exact match, route ID)
- `integration_id` (Exact match, integration ID)
- `label` (Matching labels, can be passed multiple times; expected format: `key1:value1`)
- `team_id` (Exact match, team ID)
- `started_at` (A "{start}_{end}" ISO 8601 timestamp range; expected format: `%Y-%m-%dT%H:%M:%S_%Y-%m-%dT%H:%M:%S`)
- `state` (Possible values: `new`, `acknowledged`, `resolved` or `silenced`)

**HTTP request**

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/alerts.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/alerts/
title: Alerts HTTP API
weight: 100
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/escalation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation/
title: Escalation HTTP API
weight: 1200
weight: 0
refs:
users:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/escalation_chains.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_chains/
title: Escalation chains HTTP API
weight: 200
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/escalation_policies.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_policies/
title: Escalation policies HTTP API
weight: 300
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/integrations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations/
title: Integrations HTTP API
weight: 500
weight: 0
refs:
alertmanager:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/on_call_shifts.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/on_call_shifts/
title: OnCall shifts HTTP API
weight: 600
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/organizations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/organizations/
title: Grafana OnCall organizations HTTP API
weight: 1500
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/outgoing_webhooks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks/
title: Outgoing webhooks HTTP API
weight: 700
weight: 0
refs:
outgoing-webhooks:
- pattern: /docs/oncall/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/
title: Personal notification rules HTTP API
weight: 800
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/resolution_notes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/resolution_notes/
title: Resolution notes HTTP API
weight: 900
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/routes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/routes/
title: Routes HTTP API
weight: 1100
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/schedules.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/schedules/
title: Schedules HTTP API
weight: 1200
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/shift_swaps.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/shift_swaps/
title: Shift swap requests HTTP API
weight: 1200
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/slack_channels.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/slack_channels/
title: Slack channels HTTP API
weight: 1300
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/oncall-api-reference/teams.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/teams/
title: Grafana OnCall teams HTTP API
weight: 1500
weight: 0
refs:
pagination:
- pattern: /docs/oncall/
Expand Down
Loading

0 comments on commit 43a49fc

Please sign in to comment.