Skip to content

Commit

Permalink
Add airflow db migrate command to migrateDatabaseJob (apache#34178)
Browse files Browse the repository at this point in the history
* Add airflow db migrate command to migrateDatabaseJob

* Break a long line into multiple lines
  • Loading branch information
kimminw00 authored Sep 10, 2023
1 parent 3e34079 commit 58cce7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3933,7 +3933,7 @@
"default": [
"bash",
"-c",
"exec \\\nairflow {{ semverCompare \">=2.0.0\" .Values.airflowVersion | ternary \"db upgrade\" \"upgradedb\" }}"
"exec \\\nairflow {{ semverCompare \">=2.7.0\" .Values.airflowVersion | ternary \"db migrate\" (semverCompare \">=2.0.0\" .Values.airflowVersion | ternary \"db upgrade\" \"upgradedb\") }}"
]
},
"annotations": {
Expand Down
8 changes: 5 additions & 3 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,12 @@ migrateDatabaseJob:
args:
- "bash"
- "-c"
# The format below is necessary to get `helm lint` happy
- |-
- >-
exec \
airflow {{ semverCompare ">=2.0.0" .Values.airflowVersion | ternary "db upgrade" "upgradedb" }}
airflow {{ semverCompare ">=2.7.0" .Values.airflowVersion
| ternary "db migrate" (semverCompare ">=2.0.0" .Values.airflowVersion
| ternary "db upgrade" "upgradedb") }}
# Annotations on the database migration pod
annotations: {}
Expand Down
1 change: 1 addition & 0 deletions helm_tests/airflow_aux/test_migrate_database_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def test_job_ttl_after_finished_nil(self):
[
("1.10.14", "airflow upgradedb"),
("2.0.2", "airflow db upgrade"),
("2.7.1", "airflow db migrate"),
],
)
def test_default_command_and_args_airflow_version(self, airflow_version, expected_arg):
Expand Down

0 comments on commit 58cce7d

Please sign in to comment.