From 9f0917ce5bf10f4d25ab104963e901c9cb0b300b Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Fri, 6 Oct 2023 12:52:39 +0200 Subject: [PATCH] refactor(helm): skip db migration, in conditions 1. if there are no version change 2. if skipMigration variable is set 3. if forceMigration variable is not set Signed-off-by: rjshrjndrn --- .pre-commit-config.yaml | 7 +++++++ scripts/helmcharts/openreplay/templates/job.yaml | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..c564646a6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: + - repo: https://github.com/gitguardian/ggshield + rev: v1.14.5 + hooks: + - id: ggshield + language_version: python3 + stages: [commit] diff --git a/scripts/helmcharts/openreplay/templates/job.yaml b/scripts/helmcharts/openreplay/templates/job.yaml index bd9fe474a..244fd9ea8 100644 --- a/scripts/helmcharts/openreplay/templates/job.yaml +++ b/scripts/helmcharts/openreplay/templates/job.yaml @@ -1,4 +1,10 @@ -{{- if not .Values.skipMigration}} +{{/* +Don't have to trigger migration if there is no version change +Don't have to trigger migration if skipMigration is set +Have to trigger migration if forceMigration is set +*/}} +{{- $versionChange := eq .Values.fromVersion .Chart.AppVersion}} +{{- if or (not (or .Values.skipMigration $versionChange)) .Values.forceMigration }} --- apiVersion: v1 kind: ConfigMap