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
12 changes: 12 additions & 0 deletions charts/trustify/templates/init/migrate-database/020-Job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ spec:
{{- 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 }}

{{- if and .Values.modules.migrateDatabase.dataMigrationSkip .Values.modules.migrateDatabase.dataMigrationSkipAll }}
{{- fail "dataMigrationSkip and dataMigrationSkipAll are mutually exclusive" }}
{{- end }}
{{- with .Values.modules.migrateDatabase.dataMigrationSkip }}
- name: MIGRATION_DATA_SKIP
value: {{ join "," . | quote }}
{{- end }}
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
{{- if .Values.modules.migrateDatabase.dataMigrationSkipAll }}
- name: MIGRATION_DATA_SKIP_ALL
value: "true"
{{- end }}

volumeMounts:
{{- include "trustification.storage.volumeMount" $mod | nindent 12 }}
{{- include "trustification.application.extraVolumeMounts" $mod | nindent 12 }}
Expand Down
17 changes: 17 additions & 0 deletions charts/trustify/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,23 @@
},
{
"$ref": "#/definitions/Application"
},
{
"type": "object",
"properties": {
"dataMigrationSkip": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of data migration names to skip during the migration job.\nSets the `MIGRATION_DATA_SKIP` environment variable.\n"
},
"dataMigrationSkipAll": {
"type": "boolean",
"default": false,
"description": "Skip all data migrations. Sets the `MIGRATION_DATA_SKIP_ALL` environment variable.\nConflicts with `dataMigrationSkip`.\n"
}
}
}
]
},
Expand Down
15 changes: 15 additions & 0 deletions charts/trustify/values.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,21 @@ properties:
- $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:
Comment on lines +274 to +283

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

type: boolean
default: false
description: |
Skip all data migrations. Sets the `MIGRATION_DATA_SKIP_ALL` environment variable.
Conflicts with `dataMigrationSkip`.

createImporters:
description: |
Expand Down
3 changes: 3 additions & 0 deletions charts/trustify/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ modules:
migrateDatabase:
enabled: false
image: {}
# dataMigrationSkip:
# - m0002000_add_sbom_properties
# dataMigrationSkipAll: false

createImporters:
enabled: false
Expand Down
Loading