mirror of
https://github.com/truenas/charts.git
synced 2026-04-14 10:40:31 +08:00
* plex - migrate library * temp * add migration * fix typo * cleanup * capabilties * typo * update version * fix condition * claim -> claimToken * cleanup key in migration * keep versions * correct section * token is not required * keep default port * typo
36 lines
1.3 KiB
Smarty
36 lines
1.3 KiB
Smarty
{{- define "plex.get-versions" -}}
|
|
{{- $oldChartVersion := "" -}}
|
|
{{- $newChartVersion := "" -}}
|
|
|
|
{{/* Safely access the context, so it wont block CI */}}
|
|
{{- if hasKey .Values.global "ixChartContext" -}}
|
|
{{- if .Values.global.ixChartContext.upgradeMetadata -}}
|
|
|
|
{{- $oldChartVersion = .Values.global.ixChartContext.upgradeMetadata.oldChartVersion -}}
|
|
{{- $newChartVersion = .Values.global.ixChartContext.upgradeMetadata.newChartVersion -}}
|
|
{{- if and (not $oldChartVersion) (not $newChartVersion) -}}
|
|
{{- fail "Upgrade Metadata is missing. Cannot proceed" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- toYaml (dict "old" $oldChartVersion "new" $newChartVersion) -}}
|
|
{{- end -}}
|
|
|
|
{{- define "plex.migration" -}}
|
|
{{- $versions := (fromYaml (include "plex.get-versions" $)) -}}
|
|
{{- if and $versions.old $versions.new -}}
|
|
{{- $oldV := semver $versions.old -}}
|
|
{{- $newV := semver $versions.new -}}
|
|
|
|
{{/* If new is v2.x.x */}}
|
|
{{- if eq ($newV.Major | int) 2 -}}
|
|
{{/* And old is v1.x.x, but lower than .7.60 */}}
|
|
{{- if and (eq $oldV.Major 1) (or (ne $oldV.Minor 7) (lt ($oldV.Patch | int) 60)) -}}
|
|
{{/* Block the upgrade */}}
|
|
{{- fail "Migration to 2.x.x is only allowed from 1.7.60 or higher" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|