Skip to content

Commit b4cca30

Browse files
authored
Merge pull request #773 from bcgov/upgrade-airflow-version
Upgrade airflow version
2 parents 424ff49 + 709bec6 commit b4cca30

38 files changed

+255
-142
lines changed

.github/workflows/.unit-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ jobs:
6060
run:
6161
working-directory: ./client
6262
steps:
63-
- name: Checkout
63+
- name: Checkoutup
6464
uses: actions/checkout@v4
6565
- name: Setup Node
6666
uses: actions/setup-node@v4
6767
with:
6868
node-version: '20.18.0'
69+
- name: Install Chrome
70+
uses: browser-actions/setup-chrome@v1
6971
- name: Cache NPM
7072
uses: actions/cache@v4
7173
with:
@@ -82,7 +84,7 @@ jobs:
8284
with:
8385
working-directory: ./client
8486
component: true
85-
browser: electron
87+
browser: chrome
8688
env:
8789
VITE_APP_MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
8890
VITE_BASE_API_URL: http://localhost:8000

.github/workflows/dev-pr-run-unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
unit_tests:
1111
uses: ./.github/workflows/.unit-tests.yml
1212
secrets:
13-
mapbox_token: ${{ secrets.MAPBOX_TOKEN }}
13+
mapbox_token: ${{ secrets.CYPRESS_MAPBOX_TOKEN }}

.github/workflows/foundry.okd.on-push.application.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ jobs:
191191
--set-string secrets.bcwatFlowworks.password="${{ secrets.FOUNDRY_BCWAT_FLOWWORKS_PASSWORD }}" \
192192
--set-string secrets.bcwatFlowworks.username="${{ secrets.FOUNDRY_BCWAT_FLOWWORKS_USERNAME }}" \
193193
--set-string secrets.fernet.key="${{ secrets.FOUNDRY_AIRFLOW_FERNET_KEY }}" \
194+
--set-string secrets.api.secretKey="${{ secrets.FOUNDRY_AIRFLOW_API_SECRET_KEY_}}" \
195+
--set-string secrets.api.jwtKey="${{ secrets.FOUNDRY_AIRFLOW_API_JWT_KEY_}}" \
194196
--set-string secrets.sendgridApiKey="${{ secrets.FOUNDRY_SENDGRID_API_KEY }}" \
195197
--set migrations.image=${{ secrets.ACR_REGISTRY }}/bcwat/flyway:${{ needs.bump_version.outputs.version }} \
196198
--set-string webserver.podAnnotations."rollout-timestamp"="$(date +%s)" \

airflow/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM apache/airflow:2.10.5-python3.12
1+
FROM apache/airflow:3.1.7-python3.12
22

33
USER root
44

@@ -14,7 +14,15 @@ ENV PYTHONPATH = "/opt/airflow/etl_pipelines:${PYTHONPATH}"
1414

1515
COPY requirements.txt .
1616

17+
# Switch to airflow user for pip installations
1718
USER airflow
1819

20+
# PIN AIRFLOW VERSION when installing packages
21+
RUN pip install --no-cache-dir "apache-airflow==${AIRFLOW_VERSION}" \
22+
--constraint ${HOME}/constraints.txt \
23+
apache-airflow-providers-cncf-kubernetes \
24+
apache-airflow-providers-sendgrid
25+
26+
RUN pip install --no-cache-dir apache-airflow-providers-fab==3.1.2
27+
1928
RUN pip install --no-cache-dir -r requirements.txt
20-
RUN pip install apache-airflow-providers-cncf-kubernetes apache-airflow-providers-sendgrid

airflow/Dockerfile_OKD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM apache/airflow:2.10.5-python3.12
1+
FROM apache/airflow:3.1.7-python3.12
22

33
USER root
44

@@ -10,12 +10,18 @@ COPY etl_pipelines/ /opt/airflow/etl_pipelines/
1010

1111
RUN chown -R airflow: /opt/airflow/dags /opt/airflow/etl_pipelines /opt/airflow/shared
1212

13-
1413
ENV PYTHONPATH = "/opt/airflow/etl_pipelines:${PYTHONPATH}"
1514

1615
COPY requirements.txt .
1716

1817
USER airflow
1918

19+
# PIN AIRFLOW VERSION when installing packages
20+
RUN pip install --no-cache-dir "apache-airflow==${AIRFLOW_VERSION}" \
21+
--constraint ${HOME}/constraints.txt \
22+
apache-airflow-providers-cncf-kubernetes \
23+
apache-airflow-providers-sendgrid
24+
25+
RUN pip install --no-cache-dir apache-airflow-providers-fab==3.1.2
26+
2027
RUN pip install --no-cache-dir -r requirements.txt
21-
RUN pip install apache-airflow-providers-cncf-kubernetes apache-airflow-providers-sendgrid

airflow/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ In production, we are using the `KubernetesExecutor`. This does not impact runni
2929
```bash
3030
import os
3131
from datetime import datetime
32-
from airflow.decorators import dag, task
32+
from airflow.sdk import dag, task
3333
from shared.constants import default_args
3434
from shared.functions import generate_executor_config_template
3535
from dotenv import load_dotenv, find_dotenv
@@ -41,7 +41,7 @@ ENVIRONMENT = os.getenv('ENVIRONMENT', 'no-env-found')
4141
# Does not prevent running locally
4242
# pod_template_file handles worker pod config
4343
@dag(
44-
schedule_interval="@daily",
44+
schedule="@daily",
4545
start_date=datetime(2024, 1, 1),
4646
catchup=False,
4747
tags=["example"],

airflow/dags/asp_dag.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
2-
import pendulum
3-
from airflow.decorators import dag, task
2+
from datetime import datetime
3+
from airflow.sdk import dag, task
44
from shared.constants import default_args
55
from shared.functions import generate_executor_config_template
66
from dotenv import load_dotenv, find_dotenv
@@ -10,8 +10,8 @@
1010

1111
@dag(
1212
dag_id="asp_dag",
13-
schedule_interval="5 8 * * *",
14-
start_date=pendulum.datetime(2025, 5, 7, tz="UTC"),
13+
schedule="5 8 * * *",
14+
start_date=datetime(2025, 5, 7),
1515
catchup=False,
1616
tags=["water","climate", "station_observations", "daily"],
1717
default_args=default_args

airflow/dags/ec_xml_dag.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
2-
import pendulum
3-
from airflow.decorators import dag, task
2+
from datetime import datetime
3+
from airflow.sdk import dag, task
44
from shared.constants import default_args
55
from shared.functions import generate_executor_config_template
66
from dotenv import load_dotenv, find_dotenv
@@ -10,8 +10,8 @@
1010

1111
@dag(
1212
dag_id="ec_xml_dag",
13-
schedule_interval="0 8 * * *",
14-
start_date=pendulum.datetime(2025, 5, 7, tz="UTC"),
13+
schedule="0 8 * * *",
14+
start_date=datetime(2025, 5, 7),
1515
catchup=False,
1616
tags=["climate", "station_observations", "daily"],
1717
default_args=default_args

airflow/dags/env_aqn_dag.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
2-
import pendulum
3-
from airflow.decorators import dag, task
2+
from datetime import datetime
3+
from airflow.sdk import dag, task
44
from shared.constants import default_args
55
from shared.functions import generate_executor_config_template
66
from dotenv import load_dotenv, find_dotenv
@@ -10,8 +10,8 @@
1010

1111
@dag(
1212
dag_id="env_aqn_dag",
13-
schedule_interval="0 8 * * *",
14-
start_date=pendulum.datetime(2025, 5, 15, tz="UTC"),
13+
schedule="0 8 * * *",
14+
start_date=datetime(2025, 5, 15),
1515
catchup=False,
1616
tags=["climate", "station_observations", "daily"],
1717
default_args=default_args

airflow/dags/env_hydro_dag.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
2-
import pendulum
3-
from airflow.decorators import dag, task
2+
from datetime import datetime
3+
from airflow.sdk import dag, task
44
from shared.constants import default_args
55
from shared.functions import generate_executor_config_template
66
from dotenv import load_dotenv, find_dotenv
@@ -10,8 +10,8 @@
1010

1111
@dag(
1212
dag_id="env_hydro_dag",
13-
schedule_interval="10 8 * * *",
14-
start_date=pendulum.datetime(2025, 4, 17, tz="UTC"),
13+
schedule="10 8 * * *",
14+
start_date=datetime(2025, 4, 17),
1515
catchup=False,
1616
tags=["water", "station_observations", "daily"],
1717
default_args=default_args

0 commit comments

Comments
 (0)