2024-05-14 09:53:59 -04:00
|
|
|
import os
|
|
|
|
|
from urllib.parse import urljoin
|
|
|
|
|
|
|
|
|
|
PAGERDUTY = "pagerduty"
|
|
|
|
|
SPLUNK = "splunk"
|
2025-04-07 08:47:27 -04:00
|
|
|
OPSGENIE = "opsgenie"
|
2024-05-14 09:53:59 -04:00
|
|
|
MIGRATING_FROM = os.getenv("MIGRATING_FROM")
|
2025-04-07 08:47:27 -04:00
|
|
|
assert MIGRATING_FROM in (PAGERDUTY, SPLUNK, OPSGENIE)
|
2024-05-14 09:53:59 -04:00
|
|
|
|
|
|
|
|
MODE_PLAN = "plan"
|
|
|
|
|
MODE_MIGRATE = "migrate"
|
|
|
|
|
MODE = os.getenv("MODE", default=MODE_PLAN)
|
|
|
|
|
assert MODE in (MODE_PLAN, MODE_MIGRATE)
|
|
|
|
|
|
|
|
|
|
ONCALL_API_TOKEN = os.environ["ONCALL_API_TOKEN"]
|
|
|
|
|
ONCALL_API_URL = urljoin(
|
|
|
|
|
os.environ["ONCALL_API_URL"].removesuffix("/") + "/",
|
|
|
|
|
"api/v1/",
|
|
|
|
|
)
|
|
|
|
|
ONCALL_DELAY_OPTIONS = [1, 5, 15, 30, 60]
|
|
|
|
|
|
|
|
|
|
SCHEDULE_MIGRATION_MODE_ICAL = "ical"
|
|
|
|
|
SCHEDULE_MIGRATION_MODE_WEB = "web"
|
|
|
|
|
SCHEDULE_MIGRATION_MODE = os.getenv(
|
|
|
|
|
"SCHEDULE_MIGRATION_MODE", SCHEDULE_MIGRATION_MODE_ICAL
|
|
|
|
|
)
|
Service to service model migration (#5485)
# What this PR does
Adds Service and Business Service migration to the Pager Duty Migrator.
To test, in addition to the OnCall configs, you need to crate a Grafana
Service Account with `Admin` permission and generate a token. You will
set `GRAFANA_SERVICE_ACCOUNT_URL`, per the README, to
`https://<namespace>:<token>@<server>` The namespace is the stack id, in
the format of `stacks-<stack id>`
Service migration is configurable, filterable, and idempotent.
## 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)
- [ ] 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 <joey.orlando@grafana.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: grafana-irm-app[bot] <165293418+grafana-irm-app[bot]@users.noreply.github.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2025-03-15 19:07:59 -06:00
|
|
|
|
|
|
|
|
# GRAFANA_SERVICE_ACCOUNT_URL is the URL format of a service account with
|
|
|
|
|
# Admin permission of the form: https://<namespace>:<token>@<server>
|
|
|
|
|
GRAFANA_SERVICE_ACCOUNT_URL = os.getenv("GRAFANA_SERVICE_ACCOUNT_URL", "")
|