feat: add data migration skip options to migrateDatabase job#93
Conversation
Reviewer's GuideThis PR adds configuration options to the migrateDatabase Helm module to skip specific or all data migrations by wiring new values through the chart schema, default values, and the migration Job’s environment variables. Flow diagram for migrateDatabase data migration skip configurationflowchart LR
values_yaml["values.yaml modules.migrateDatabase"] --> schema["values.schema.yaml migrateDatabase module schema"]
schema --> tmpl["020-Job.yaml Helm template"]
values_yaml -->|dataMigrationSkip list| env_skip["MIGRATION_DATA_SKIP env var"]
values_yaml -->|dataMigrationSkipAll true| env_skip_all["MIGRATION_DATA_SKIP_ALL env var"]
tmpl --> env_skip
tmpl --> env_skip_all
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- The values.schema.yaml description says dataMigrationSkipAll conflicts with dataMigrationSkip, but this isn’t enforced; consider adding explicit schema validation or Helm template logic to fail or ignore one when both are set.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The values.schema.yaml description says dataMigrationSkipAll conflicts with dataMigrationSkip, but this isn’t enforced; consider adding explicit schema validation or Helm template logic to fail or ignore one when both are set.
## Individual Comments
### Comment 1
<location path="charts/trustify/values.schema.yaml" line_range="274-283" />
<code_context>
- $ref: "#/definitions/Feature"
- $ref: "#/definitions/Image"
- $ref: "#/definitions/Application"
+ - type: object
+ properties:
+ dataMigrationSkip:
+ type: array
+ items:
+ type: string
+ description: |
+ List of data migration names to skip during the migration job.
+ Sets the `MIGRATION_DATA_SKIP` environment variable.
+ dataMigrationSkipAll:
+ type: boolean
+ default: false
+ description: |
+ Skip all data migrations. Sets the `MIGRATION_DATA_SKIP_ALL` environment variable.
+ Conflicts with `dataMigrationSkip`.
createImporters:
</code_context>
<issue_to_address>
**issue (bug_risk):** New migrateDatabase object in the `oneOf` may conflict with existing usages of Feature/Image/Application.
Adding a plain `type: object` branch with `dataMigrationSkip` / `dataMigrationSkipAll` makes the `oneOf` describe four mutually exclusive shapes. Because `values.yaml` uses both `image: {}` and these migration fields, a strict JSON Schema validator would reject it for matching multiple `oneOf` branches. If these fields are meant to extend Application (or another existing definition), consider using `allOf` to compose them in, or add them directly to that definition instead of via `oneOf`.
</issue_to_address>
### Comment 2
<location path="charts/trustify/templates/init/migrate-database/020-Job.yaml" line_range="49-52" />
<code_context>
{{- include "trustification.postgres.envVars" ( dict "root" . "database" ( merge ( required "Using migrateDatabase requires setting .Values.migrateDatabase" (deepCopy .Values.migrateDatabase) ) ( deepCopy .Values.database ) ) ) | nindent 12 }}
{{- include "trustification.storage.envVars" $mod | nindent 12 }}
+ {{- with .Values.modules.migrateDatabase.dataMigrationSkip }}
+ - name: MIGRATION_DATA_SKIP
+ value: {{ join "," . | quote }}
+ {{- end }}
+ {{- if .Values.modules.migrateDatabase.dataMigrationSkipAll }}
+ - name: MIGRATION_DATA_SKIP_ALL
</code_context>
<issue_to_address>
**suggestion (bug_risk):** `dataMigrationSkip` and `dataMigrationSkipAll` can be set simultaneously despite being described as conflicting.
The chart currently permits both values, causing both `MIGRATION_DATA_SKIP` and `MIGRATION_DATA_SKIP_ALL` to be set, which contradicts their documented conflict and may yield ambiguous behavior in the migration job. Please either enforce mutual exclusivity in the template (e.g., fail when both are set) or define and rely on a clear precedence rule when both are present.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - type: object | ||
| properties: | ||
| dataMigrationSkip: | ||
| type: array | ||
| items: | ||
| type: string | ||
| description: | | ||
| List of data migration names to skip during the migration job. | ||
| Sets the `MIGRATION_DATA_SKIP` environment variable. | ||
| dataMigrationSkipAll: |
There was a problem hiding this comment.
issue (bug_risk): New migrateDatabase object in the oneOf may conflict with existing usages of Feature/Image/Application.
Adding a plain type: object branch with dataMigrationSkip / dataMigrationSkipAll makes the oneOf describe four mutually exclusive shapes. Because values.yaml uses both image: {} and these migration fields, a strict JSON Schema validator would reject it for matching multiple oneOf branches. If these fields are meant to extend Application (or another existing definition), consider using allOf to compose them in, or add them directly to that definition instead of via oneOf.
04e5d6a to
04bbc22
Compare
Allow skipping specific or all data migrations during the migration job via `dataMigrationSkip` and `dataMigrationSkipAll` values, which set the `MIGRATION_DATA_SKIP` and `MIGRATION_DATA_SKIP_ALL` environment variables. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
04bbc22 to
242690b
Compare
Summary
dataMigrationSkip(list of migration names) anddataMigrationSkipAll(boolean) values to themigrateDatabasemoduleMIGRATION_DATA_SKIPandMIGRATION_DATA_SKIP_ALLenvironment variables on the migration jobExample usage
or to skip all data migrations:
Test plan
helm templatewithdataMigrationSkiplist rendersMIGRATION_DATA_SKIPwith comma-separated valueshelm templatewithdataMigrationSkipAll: truerendersMIGRATION_DATA_SKIP_ALL=truehelm templatewithout either option renders noMIGRATION_DATA_*env vars🤖 Generated with Claude Code
Summary by Sourcery
Add configuration options to control skipping data migrations in the migrateDatabase Helm module.
New Features:
Enhancements: