Skip to content

Commit

Permalink
Merge pull request #335 from darkdoc/fix_seed_pipeline
Browse files Browse the repository at this point in the history
Fix commit and push parallelization issue
  • Loading branch information
mbaldessari authored Jan 15, 2025
2 parents b304158 + c83cc1b commit 32d7d64
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
14 changes: 10 additions & 4 deletions charts/datacenter/pipelines/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ ie-registry
{{- end }}
{{- end }}

{{- define "build-base-images" -}}
- name: buildah-build
{{- define "build-frontend-base-image" -}}
- name: build-base-image
taskRef:
name: buildah
runAfter:
Expand All @@ -42,16 +42,20 @@ ie-registry
value: IMAGE_ACCOUNT
- name: OUTPUT_IMAGE_NAME
value: httpd-ionic
{{- end }} {{/* build-base-images */}}
{{- end }} {{/* build-frontend-base-image */}}

{{- define "build-iot-component" }}
- name: bump-build-version-{{ .component.component_name }}
displayName: "Bump version for {{ .component.component_name }}"
taskRef:
name: bumpversion
runAfter:
{{- if (eq .component.component_name "iot-frontend") }}
- build-base-image
{{- else }}
- git-clone-ops
- git-clone-dev
{{- end }}
workspaces:
- name: gitrepos
workspace: gitrepos
Expand Down Expand Up @@ -160,7 +164,9 @@ ie-registry
value: $(tasks.bump-build-version-{{ .component.component_name }}.results.image-tag)
- name: subdirectory
value: ops
{{- end }} {{/* build-iot-component */}}

{{- define "commit-and-push-ops-iot-component" -}}
- name: commit-ops-{{ .component.component_name }}
taskRef:
name: git-commit
Expand Down Expand Up @@ -188,7 +194,7 @@ ie-registry
value: ops
- name: PUSH_FLAGS
value: --all
{{- end }} {{/* build-iot-component */}}
{{- end }} {{/* commit-and-push-ops-iot-component */}}

{{- define "test-all" }}
- name: sensor-broker-test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{{- range .Values.pipeline_components }}
---
{{/*- include "build-iot-component" (dict "root" $.Values "component" . "seed_prod" "true") | nindent 4 */}}
{{/*- include "test_include" (dict "root" $.Values "component" . "seed_prod" "true") | nindent 4 */}}

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
Expand Down Expand Up @@ -51,6 +48,10 @@ spec:
- name: deleteExisting
value: "true"

{{- if (eq .component_name "iot-frontend") -}}
{{- include "build-frontend-base-image" $ | nindent 2 }}
{{- end }}

{{- include "build-iot-component" (dict "root" $.Values "component" . "seed_prod" "false") | nindent 2 }}

- name: argocd-sync-application
Expand All @@ -71,6 +72,8 @@ spec:
- name: argocd-server
value: "{{ $.Values.clusterGroup.name }}-gitops-server.{{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}.svc"

{{- include "commit-and-push-ops-iot-component" (dict "root" $.Values "component" . ) | nindent 2 }}

{{- include "test-all" . | nindent 2 }}

{{- include "trigger-staging" (dict "root" $.Values "component" . ) | nindent 2 }}
Expand Down
36 changes: 33 additions & 3 deletions charts/datacenter/pipelines/templates/pipelines/seed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,38 @@ spec:
- name: deleteExisting
value: "true"

{{- include "build-base-images" $ | nindent 4 }}
{{- range .Values.pipeline_components }}
{{- if (eq .component_name "iot-frontend") -}}
{{- include "build-frontend-base-image" $ | nindent 4 }}
{{- end }}
{{- include "build-iot-component" (dict "root" $.Values "component" . "seed_prod" "true") | nindent 4 }}
{{/*- include "test_include" (dict "root" $.Values "component" . "seed_prod" "true") | nindent 4 */}}
{{- end }}
{{- end }}
- name: commit-ops
taskRef:
name: git-commit
runAfter:
{{- range .Values.pipeline_components }}
- modify-ops-prod-iot-component-{{ .component_name }}
{{- end }}
workspaces:
- name: gitrepos
workspace: gitrepos
- name: config
workspace: config
params:
- name: subdirectory
value: ops

- name: push-ops
taskRef:
name: github-push
runAfter:
- commit-ops
workspaces:
- name: gitrepos
workspace: gitrepos
params:
- name: subdirectory
value: ops
- name: PUSH_FLAGS
value: --all

0 comments on commit 32d7d64

Please sign in to comment.