Skip to content

Commit b2ffce3

Browse files
authored
Merge pull request #6164 from bcgov/feat/6028
chore(5812): add request review reminders for test, prod
2 parents 67b6f00 + 8640eb8 commit b2ffce3

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import os
2+
from airflow import DAG
3+
from airflow.operators.python import PythonOperator
4+
from datetime import datetime, timedelta
5+
from _request_review_reminder import send_request_review_reminders
6+
from _task_failure_callback import send_alert
7+
8+
APP_URL = "https://registry.developer.gov.bc.ca"
9+
MONGO_CONN_ID = "pltsvc-prod"
10+
11+
KC_AUTH_URL = "https://loginproxy.gov.bc.ca/auth"
12+
KC_REALM = "platform-services"
13+
KC_SA_ID = os.getenv("PROD_KEYCLOAK_ADMIN_CLIENT_ID")
14+
KC_SA_SECRET = os.getenv("PROD_KEYCLOAK_ADMIN_CLIENT_SECRET")
15+
16+
CHES_AUTH_URL = "https://loginproxy.gov.bc.ca/auth"
17+
CHES_REALM = "comsvcauth"
18+
CHES_SA_ID = os.getenv("PROD_CHES_SA_ID")
19+
CHES_SA_SECRET = os.getenv("PROD_CHES_SA_SECRET")
20+
CHES_API_URL = "https://ches.api.gov.bc.ca/api/v1"
21+
22+
with DAG(
23+
dag_id="request_review_reminder_prod",
24+
description="A DAG to send reminders for review of private cloud requests",
25+
schedule="20 0 * * *",
26+
start_date=datetime.now() - timedelta(weeks=1),
27+
is_paused_upon_creation=False,
28+
catchup=False,
29+
) as dag:
30+
t1 = PythonOperator(
31+
task_id="request-review-reminder",
32+
python_callable=send_request_review_reminders,
33+
op_kwargs={
34+
"app_url": APP_URL,
35+
"mongo_conn_id": MONGO_CONN_ID,
36+
"kc_auth_url": KC_AUTH_URL,
37+
"kc_realm": KC_REALM,
38+
"kc_client_id": KC_SA_ID,
39+
"kc_client_secret": KC_SA_SECRET,
40+
"ches_api_url": CHES_API_URL,
41+
"ches_auth_url": CHES_AUTH_URL,
42+
"ches_realm": CHES_REALM,
43+
"ches_client_id": CHES_SA_ID,
44+
"ches_client_secret": CHES_SA_SECRET,
45+
},
46+
on_failure_callback=lambda context: send_alert(context, context["dag"].dag_id),
47+
)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import os
2+
from airflow import DAG
3+
from airflow.operators.python import PythonOperator
4+
from datetime import datetime, timedelta
5+
from _request_review_reminder import send_request_review_reminders
6+
from _task_failure_callback import send_alert
7+
8+
APP_URL = "https://test-pltsvc.apps.silver.devops.gov.bc.ca"
9+
MONGO_CONN_ID = "pltsvc-test"
10+
11+
KC_AUTH_URL = "https://test.loginproxy.gov.bc.ca/auth"
12+
KC_REALM = "platform-services"
13+
KC_SA_ID = os.getenv("TEST_KEYCLOAK_ADMIN_CLIENT_ID")
14+
KC_SA_SECRET = os.getenv("TEST_KEYCLOAK_ADMIN_CLIENT_SECRET")
15+
16+
CHES_AUTH_URL = "https://test.loginproxy.gov.bc.ca/auth"
17+
CHES_REALM = "comsvcauth"
18+
CHES_SA_ID = os.getenv("TEST_CHES_SA_ID")
19+
CHES_SA_SECRET = os.getenv("TEST_CHES_SA_SECRET")
20+
CHES_API_URL = "https://ches-dev.api.gov.bc.ca/api/v1"
21+
22+
with DAG(
23+
dag_id="request_review_reminder_test",
24+
description="A DAG to send reminders for review of private cloud requests",
25+
schedule="10 0 * * *",
26+
start_date=datetime.now() - timedelta(weeks=1),
27+
is_paused_upon_creation=False,
28+
catchup=False,
29+
) as dag:
30+
t1 = PythonOperator(
31+
task_id="request-review-reminder",
32+
python_callable=send_request_review_reminders,
33+
op_kwargs={
34+
"app_url": APP_URL,
35+
"mongo_conn_id": MONGO_CONN_ID,
36+
"kc_auth_url": KC_AUTH_URL,
37+
"kc_realm": KC_REALM,
38+
"kc_client_id": KC_SA_ID,
39+
"kc_client_secret": KC_SA_SECRET,
40+
"ches_api_url": CHES_API_URL,
41+
"ches_auth_url": CHES_AUTH_URL,
42+
"ches_realm": CHES_REALM,
43+
"ches_client_id": CHES_SA_ID,
44+
"ches_client_secret": CHES_SA_SECRET,
45+
},
46+
on_failure_callback=lambda context: send_alert(context, context["dag"].dag_id),
47+
)

0 commit comments

Comments
 (0)