Loading assets/auto-deploy-app/templates/cronjob.yaml +13 −5 Original line number Diff line number Diff line Loading @@ -12,12 +12,16 @@ items: metadata: name: "{{ template "trackableappname" $ }}-{{ $jobName}}" annotations: {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} {{- if $.Values.gitlab.app }} app.gitlab.com/app: {{ $.Values.gitlab.app | quote }} {{- end }} {{- if $.Values.gitlab.env }} app.gitlab.com/env: {{ $.Values.gitlab.env | quote }} {{- end }} labels: track: "{{ $.Values.application.track }}" tier: "{{ $.Values.application.tier }}" {{ include "sharedlabels" $ | nindent 6 }} {{- include "sharedlabels" $ | nindent 6 }} spec: concurrencyPolicy: {{ default "Forbid" $jobConfig.concurrencyPolicy }} failedJobsHistoryLimit: {{ default 1 $jobConfig.failedJobsHistoryLimit }} Loading @@ -36,8 +40,12 @@ items: metadata: annotations: checksum/application-secrets: "{{ $.Values.application.secretChecksum }}" {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} {{- if $.Values.gitlab.app }} app.gitlab.com/app: {{ $.Values.gitlab.app | quote }} {{- end }} {{- if $.Values.gitlab.env }} app.gitlab.com/env: {{ $.Values.gitlab.env | quote }} {{- end }} {{- if $.Values.podAnnotations }} {{- toYaml $.Values.podAnnotations | nindent 14 }} {{- end }} Loading assets/auto-deploy-app/test/templates/cronjob_test.go +17 −104 Original line number Diff line number Diff line Loading @@ -161,14 +161,7 @@ func TestCronjobSchedule(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -226,14 +219,7 @@ func TestCronjobImage(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -368,14 +354,7 @@ func TestCronjobLivenessAndReadiness(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -436,14 +415,7 @@ func TestCronjobNodeSelector(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -527,14 +499,7 @@ func TestCronjobTolerations(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -607,12 +572,7 @@ func TestCronjobResources(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -626,7 +586,6 @@ func TestCronjobResources(t *testing.T) { func TestCronjobTemplateWithVolumeMounts(t *testing.T) { releaseName := "cronjob-with-volume-mounts-test" templates := []string{"templates/cronjob.yaml"} hostPathDirectoryType := coreV1.HostPathDirectory configMapOptional := false Loading Loading @@ -697,18 +656,11 @@ func TestCronjobTemplateWithVolumeMounts(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ ValuesFiles: tc.valueFiles, SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -817,14 +769,7 @@ func TestCronjobAffinity(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -838,7 +783,6 @@ func TestCronjobAffinity(t *testing.T) { func TestCronJobTemplateWithExtraEnvFrom(t *testing.T) { releaseName := "cronjob-with-extra-envfrom-test" templates := []string{"templates/cronjob.yaml"} tcs := []struct { name string Loading Loading @@ -892,17 +836,10 @@ func TestCronJobTemplateWithExtraEnvFrom(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -915,7 +852,6 @@ func TestCronJobTemplateWithExtraEnvFrom(t *testing.T) { func TestCronJobTemplateWithSecurityContext(t *testing.T) { releaseName := "cronjob-with-security-context" templates := []string{"templates/cronjob.yaml"} tcs := []struct { name string Loading @@ -933,17 +869,11 @@ func TestCronJobTemplateWithSecurityContext(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -956,7 +886,6 @@ func TestCronJobTemplateWithSecurityContext(t *testing.T) { func TestCronJobTemplateWithContainerSecurityContext(t *testing.T) { releaseName := "cronjob-with-container-security-context" templates := []string{"templates/cronjob.yaml"} tcs := []struct { name string Loading @@ -976,17 +905,11 @@ func TestCronJobTemplateWithContainerSecurityContext(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -1088,12 +1011,7 @@ func TestCronjobImagePullSecrets(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -1183,12 +1101,7 @@ func TestCronjobPodAnnotations(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading
assets/auto-deploy-app/templates/cronjob.yaml +13 −5 Original line number Diff line number Diff line Loading @@ -12,12 +12,16 @@ items: metadata: name: "{{ template "trackableappname" $ }}-{{ $jobName}}" annotations: {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} {{- if $.Values.gitlab.app }} app.gitlab.com/app: {{ $.Values.gitlab.app | quote }} {{- end }} {{- if $.Values.gitlab.env }} app.gitlab.com/env: {{ $.Values.gitlab.env | quote }} {{- end }} labels: track: "{{ $.Values.application.track }}" tier: "{{ $.Values.application.tier }}" {{ include "sharedlabels" $ | nindent 6 }} {{- include "sharedlabels" $ | nindent 6 }} spec: concurrencyPolicy: {{ default "Forbid" $jobConfig.concurrencyPolicy }} failedJobsHistoryLimit: {{ default 1 $jobConfig.failedJobsHistoryLimit }} Loading @@ -36,8 +40,12 @@ items: metadata: annotations: checksum/application-secrets: "{{ $.Values.application.secretChecksum }}" {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} {{- if $.Values.gitlab.app }} app.gitlab.com/app: {{ $.Values.gitlab.app | quote }} {{- end }} {{- if $.Values.gitlab.env }} app.gitlab.com/env: {{ $.Values.gitlab.env | quote }} {{- end }} {{- if $.Values.podAnnotations }} {{- toYaml $.Values.podAnnotations | nindent 14 }} {{- end }} Loading
assets/auto-deploy-app/test/templates/cronjob_test.go +17 −104 Original line number Diff line number Diff line Loading @@ -161,14 +161,7 @@ func TestCronjobSchedule(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -226,14 +219,7 @@ func TestCronjobImage(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -368,14 +354,7 @@ func TestCronjobLivenessAndReadiness(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -436,14 +415,7 @@ func TestCronjobNodeSelector(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -527,14 +499,7 @@ func TestCronjobTolerations(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -607,12 +572,7 @@ func TestCronjobResources(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -626,7 +586,6 @@ func TestCronjobResources(t *testing.T) { func TestCronjobTemplateWithVolumeMounts(t *testing.T) { releaseName := "cronjob-with-volume-mounts-test" templates := []string{"templates/cronjob.yaml"} hostPathDirectoryType := coreV1.HostPathDirectory configMapOptional := false Loading Loading @@ -697,18 +656,11 @@ func TestCronjobTemplateWithVolumeMounts(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ ValuesFiles: tc.valueFiles, SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -817,14 +769,7 @@ func TestCronjobAffinity(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -838,7 +783,6 @@ func TestCronjobAffinity(t *testing.T) { func TestCronJobTemplateWithExtraEnvFrom(t *testing.T) { releaseName := "cronjob-with-extra-envfrom-test" templates := []string{"templates/cronjob.yaml"} tcs := []struct { name string Loading Loading @@ -892,17 +836,10 @@ func TestCronJobTemplateWithExtraEnvFrom(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -915,7 +852,6 @@ func TestCronJobTemplateWithExtraEnvFrom(t *testing.T) { func TestCronJobTemplateWithSecurityContext(t *testing.T) { releaseName := "cronjob-with-security-context" templates := []string{"templates/cronjob.yaml"} tcs := []struct { name string Loading @@ -933,17 +869,11 @@ func TestCronJobTemplateWithSecurityContext(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading @@ -956,7 +886,6 @@ func TestCronJobTemplateWithSecurityContext(t *testing.T) { func TestCronJobTemplateWithContainerSecurityContext(t *testing.T) { releaseName := "cronjob-with-container-security-context" templates := []string{"templates/cronjob.yaml"} tcs := []struct { name string Loading @@ -976,17 +905,11 @@ func TestCronJobTemplateWithContainerSecurityContext(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { opts := &helm.Options{ options := &helm.Options{ SetValues: tc.values, } output, err := helm.RenderTemplateE(t, opts, helmChartPath, releaseName, templates) if err != nil { t.Error(err) return } require.NotRegexp(t, regexp.MustCompile("\n[[:space:]]*\n"), output, "found empty lines in output") output := renderTemplate(t, options, releaseName, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -1088,12 +1011,7 @@ func TestCronjobImagePullSecrets(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading Loading @@ -1183,12 +1101,7 @@ func TestCronjobPodAnnotations(t *testing.T) { KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), } output, err := helm.RenderTemplateE(t, options, helmChartPath, tc.Release, []string{"templates/cronjob.yaml"}) if err != nil { t.Error(err) return } output := renderTemplate(t, options, tc.Release, []string{"templates/cronjob.yaml"}, nil) var cronjobs batchV1beta1.CronJobList helm.UnmarshalK8SYaml(t, output, &cronjobs) Loading