Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10195,9 +10195,7 @@
"items": {
"type": "string"
},
"default": [
"bash"
]
"default": null
},
"args": {
"description": "Args to use when running the database cleanup cronjob (templated).",
Expand All @@ -10209,6 +10207,7 @@
"type": "string"
},
"default": [
"bash",
"-c",
"CLEAN_TS=$(date -d \"-{{ .Values.databaseCleanup.retentionDays }} days\" +\"%Y-%m-%dT%H:%M:%S\"); echo \"Cleaning up metadata DB entries older than ${CLEAN_TS}\"; exec airflow db clean --clean-before-timestamp \"${CLEAN_TS}\" --yes {{- if .Values.databaseCleanup.skipArchive }} --skip-archive{{ end }} {{- if .Values.databaseCleanup.verbose }} --verbose{{ end }} {{- with .Values.databaseCleanup.batchSize }} --batch-size {{ . }}{{ end }} {{- with .Values.databaseCleanup.tables }} --tables {{ . | join \",\" }}{{ end }}"
]
Expand Down
4 changes: 2 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3379,10 +3379,10 @@ databaseCleanup:
# Run every week on Sunday at midnight (templated).
schedule: "0 0 * * 0"
# Command to use when running the database cleanup cronjob (templated).
command:
- "bash"
command: ~
# Args to use when running the database cleanup cronjob (templated).
args:
- "bash"
- "-c"
- >-
CLEAN_TS=$(date -d "-{{ .Values.databaseCleanup.retentionDays }} days" +"%Y-%m-%dT%H:%M:%S");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def test_retention_days_changed(self):
)

assert jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].args", docs[0]) == [
"bash",
"-c",
'CLEAN_TS=$(date -d "-10 days" +"%Y-%m-%dT%H:%M:%S"); echo "Cleaning up metadata DB entries older than ${CLEAN_TS}"; exec airflow db clean --clean-before-timestamp "${CLEAN_TS}" --yes --verbose',
]
Expand All @@ -198,10 +199,9 @@ def test_default_command_and_args(self):
show_only=["templates/database-cleanup/database-cleanup-cronjob.yaml"],
)

assert jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].command", docs[0]) == [
"bash"
]
assert jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].command", docs[0]) is None
assert jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].args", docs[0]) == [
"bash",
"-c",
'CLEAN_TS=$(date -d "-90 days" +"%Y-%m-%dT%H:%M:%S"); echo "Cleaning up metadata DB entries older than ${CLEAN_TS}"; exec airflow db clean --clean-before-timestamp "${CLEAN_TS}" --yes --verbose',
]
Expand Down Expand Up @@ -241,10 +241,9 @@ def test_cleanup_command_options(
show_only=["templates/database-cleanup/database-cleanup-cronjob.yaml"],
)

assert jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].command", docs[0]) == [
"bash"
]
assert jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].command", docs[0]) is None
assert jmespath.search("spec.jobTemplate.spec.template.spec.containers[0].args", docs[0]) == [
"bash",
"-c",
f'CLEAN_TS=$(date -d "-{retention} days" +"%Y-%m-%dT%H:%M:%S"); echo "Cleaning up metadata DB entries older than ${{CLEAN_TS}}"; exec airflow db clean --clean-before-timestamp "${{CLEAN_TS}}" --yes{command_args}',
]
Expand Down
Loading