Skip to content

Commit 120ab9d

Browse files
authored
Merge pull request #6325 from bcgov/chore/oc-deployer
chore(airflow): upgrade Airflow image
2 parents 8e0c95c + e176905 commit 120ab9d

File tree

3 files changed

+43
-49
lines changed

3 files changed

+43
-49
lines changed

helm/tools/Chart.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ dependencies:
1717
- name: sorry-cypress
1818
repository: https://sorry-cypress.github.io/charts
1919
version: 1.20.0
20-
digest: sha256:ae449569b2d3e0f09ecd8a68c242b2b7e21854a70f59d4ed9080488af58c50fe
21-
generated: "2025-08-18T12:32:09.384857059-07:00"
20+
digest: sha256:cb46129f6c0f305fd8e66be03de5212128a8f2d54b6b9c6b795b6b732e809ad3
21+
generated: "2025-08-18T13:21:29.538770364-07:00"

helm/tools/dags/_mark_provisioned.py

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,52 +22,46 @@ def fetch_products_mark_completed(
2222
- Any exceptions that occur during the execution.
2323
"""
2424

25-
try:
26-
# Establish MongoDB connection
27-
db = get_mongo_db(mongo_conn_id)
28-
requests_collection = db["PrivateCloudRequest"]
29-
requested_projects_collection = db["PrivateCloudRequestData"]
25+
# Establish MongoDB connection
26+
db = get_mongo_db(mongo_conn_id)
27+
requests_collection = db["PrivateCloudRequest"]
28+
requested_projects_collection = db["PrivateCloudRequestData"]
3029

31-
product_requests = requests_collection.find(
32-
{"decisionStatus": "APPROVED"}, projection={"_id": True, "licencePlate": True, "decisionDataId": True}
33-
)
34-
35-
for request in product_requests:
36-
request_id = request["_id"]
37-
licence_plate = request["licencePlate"]
38-
decision_data_id = ObjectId(request["decisionDataId"])
39-
# a call to the RequestedProject table to get cluster
40-
requested_project_document = requested_projects_collection.find_one(
41-
{"_id": decision_data_id}, projection={"cluster": True}
42-
)
43-
cluster = requested_project_document.get("cluster").lower()
44-
# start of provisioner logic
45-
workflow_name = f"{cluster}-{licence_plate}-{request_id}"
46-
provisioner_workflow_url = f"{provisioner_api_url}/{workflow_name}"
47-
request_status_in_provisioner = requests.get(provisioner_workflow_url).json()
48-
if not keys_exist(request_status_in_provisioner, "metadata", "labels", "workflows.argoproj.io/phase"):
49-
continue
30+
product_requests = requests_collection.find(
31+
{"decisionStatus": "APPROVED"}, projection={"_id": True, "licencePlate": True, "decisionDataId": True}
32+
)
5033

51-
request_phase = request_status_in_provisioner["metadata"]["labels"]["workflows.argoproj.io/phase"]
52-
if request_phase == "Running":
53-
continue
54-
elif request_phase == "Error" or request_phase == "Failed":
55-
# TODO: add resend logic here in the future
56-
continue
57-
elif request_phase == "Succeeded":
58-
# Call the callback URL to mark the product as Provisioned
59-
mark_provisioned_url = f"{mark_provisioned_url}/{licence_plate}/provision"
60-
kc = Keycloak(kc_auth_url, kc_realm, kc_client_id, kc_client_secret)
61-
access_token = kc.get_access_token()
62-
headers = {"Authorization": f"Bearer {access_token}", "Content-Type": "application/json"}
63-
response = requests.post(mark_provisioned_url, headers=headers, json={})
34+
for request in product_requests:
35+
request_id = request["_id"]
36+
licence_plate = request["licencePlate"]
37+
decision_data_id = ObjectId(request["decisionDataId"])
38+
# a call to the RequestedProject table to get cluster
39+
requested_project_document = requested_projects_collection.find_one(
40+
{"_id": decision_data_id}, projection={"cluster": True}
41+
)
42+
cluster = requested_project_document.get("cluster").lower()
43+
# start of provisioner logic
44+
workflow_name = f"{cluster}-{licence_plate}-{request_id}"
45+
provisioner_workflow_url = f"{provisioner_api_url}/{workflow_name}"
46+
request_status_in_provisioner = requests.get(provisioner_workflow_url).json()
47+
if not keys_exist(request_status_in_provisioner, "metadata", "labels", "workflows.argoproj.io/phase"):
48+
continue
6449

65-
if response.status_code != 200:
66-
print(
67-
f"Error while marking {licence_plate} as Provisioned: {response.status_code} - {response.reason}"
68-
)
69-
else:
70-
print(f"Marked {licence_plate} as Provisioned")
50+
request_phase = request_status_in_provisioner["metadata"]["labels"]["workflows.argoproj.io/phase"]
51+
if request_phase == "Running":
52+
continue
53+
elif request_phase == "Error" or request_phase == "Failed":
54+
# TODO: add resend logic here in the future
55+
continue
56+
elif request_phase == "Succeeded":
57+
# Call the callback URL to mark the product as Provisioned
58+
mark_provisioned_url = f"{mark_provisioned_url}/{licence_plate}/provision"
59+
kc = Keycloak(kc_auth_url, kc_realm, kc_client_id, kc_client_secret)
60+
access_token = kc.get_access_token()
61+
headers = {"Authorization": f"Bearer {access_token}", "Content-Type": "application/json"}
62+
response = requests.post(mark_provisioned_url, headers=headers, json={})
7163

72-
except Exception as e:
73-
print(f"[fetch_products_mark_completed] Error: {e}")
64+
if response.status_code != 200:
65+
print(f"Error while marking {licence_plate} as Provisioned: {response.status_code} - {response.reason}")
66+
else:
67+
print(f"Marked {licence_plate} as Provisioned")

helm/tools/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ airflow:
4747

4848
defaultAirflowRepository: ghcr.io/bcgov/pltsvc-tools-airflow
4949
# See https://github.com/bcgov/platform-services-registry/pkgs/container/pltsvc-tools-airflow
50-
defaultAirflowTag: "481e049394a63cbd2b4157c00e9ea3530e192f89" # pragma: allowlist secret
50+
defaultAirflowTag: "d401385d6f17815db1b28f754ba76ab79dbe9f9f" # pragma: allowlist secret
5151

52-
airflowVersion: "3.0.2"
52+
airflowVersion: "3.0.4"
5353

5454
images:
5555
useDefaultImageForMigration: false

0 commit comments

Comments
 (0)