Skip to content

Commit 9ac4dcc

Browse files
authored
feat: add argocd sync waves to ensure tasks and pipelines are created in the right order (#2117)
1 parent c39bc9b commit 9ac4dcc

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

charts/team-ns/templates/builds/buildpack.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ metadata:
88
name: buildpacks-build-{{ .name }}
99
annotations:
1010
sidecar.istio.io/inject: "false"
11+
# ArgoCD sync wave annotation to ensure it's applied first
12+
argocd.argoproj.io/sync-wave: "-2"
1113
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
1214
spec:
1315
workspaces:
@@ -87,6 +89,8 @@ apiVersion: triggers.tekton.dev/v1alpha1
8789
kind: TriggerTemplate
8890
metadata:
8991
name: trigger-template-{{ .name }}
92+
annotations:
93+
argocd.argoproj.io/sync-wave: "-1"
9094
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
9195
spec:
9296
resourcetemplates:
@@ -146,6 +150,8 @@ metadata:
146150
annotations:
147151
sidecar.istio.io/inject: "false"
148152
argocd.argoproj.io/compare-options: IgnoreExtraneous
153+
# ArgoCD sync wave annotation to ensure it's applied after the pipeline
154+
argocd.argoproj.io/sync-wave: "5"
149155
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
150156
spec:
151157
pipelineRef:
@@ -190,6 +196,8 @@ spec:
190196
apiVersion: triggers.tekton.dev/v1alpha1
191197
kind: TriggerBinding
192198
metadata:
199+
annotations:
200+
argocd.argoproj.io/sync-wave: "-1"
193201
name: gitea-triggerbinding-{{ .name }}
194202
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
195203
spec:
@@ -203,6 +211,8 @@ apiVersion: triggers.tekton.dev/v1alpha1
203211
kind: EventListener
204212
metadata:
205213
name: gitea-webhook-{{ .name }}
214+
annotations:
215+
argocd.argoproj.io/sync-wave: "-1"
206216
labels:
207217
tekton.dev/pipeline: buildpacks-build-{{ .name }}
208218
{{- include "team-ns.chart-labels" $ | nindent 4 }}
@@ -218,4 +228,4 @@ spec:
218228
---
219229
{{- end }}
220230
{{- end }}
221-
{{- end }}
231+
{{- end }}

charts/team-ns/templates/builds/docker.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ metadata:
99
name: docker-build-{{ .name }}
1010
annotations:
1111
sidecar.istio.io/inject: "false"
12+
# ArgoCD sync wave annotation to ensure it's applied first
13+
argocd.argoproj.io/sync-wave: "-2"
1214
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
1315
spec:
1416
workspaces:
@@ -85,6 +87,8 @@ apiVersion: triggers.tekton.dev/v1alpha1
8587
kind: TriggerTemplate
8688
metadata:
8789
name: trigger-template-{{ .name }}
90+
annotations:
91+
argocd.argoproj.io/sync-wave: "-1"
8892
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
8993
spec:
9094
resourcetemplates:
@@ -137,13 +141,16 @@ spec:
137141
secretName: harbor-pushsecret-builds
138142
---
139143
{{- else }}
144+
# Create PipelineRun with a higher sync wave to ensure it's created after the Pipeline
140145
apiVersion: tekton.dev/v1
141146
kind: PipelineRun
142147
metadata:
143148
name: docker-build-{{ .name }}
144149
annotations:
145150
sidecar.istio.io/inject: "false"
146151
argocd.argoproj.io/compare-options: IgnoreExtraneous
152+
# ArgoCD sync wave annotation to ensure it's applied after the pipeline
153+
argocd.argoproj.io/sync-wave: "5"
147154
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
148155
spec:
149156
pipelineRef:
@@ -189,6 +196,8 @@ apiVersion: triggers.tekton.dev/v1alpha1
189196
kind: TriggerBinding
190197
metadata:
191198
name: gitea-triggerbinding-{{ .name }}
199+
annotations:
200+
argocd.argoproj.io/sync-wave: "-1"
192201
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
193202
spec:
194203
params:
@@ -201,6 +210,8 @@ apiVersion: triggers.tekton.dev/v1alpha1
201210
kind: EventListener
202211
metadata:
203212
name: gitea-webhook-{{ .name }}
213+
annotations:
214+
argocd.argoproj.io/sync-wave: "-1"
204215
labels:
205216
tekton.dev/pipeline: docker-build-{{ .name }}
206217
{{- include "team-ns.chart-labels" $ | nindent 4 }}
@@ -216,4 +227,4 @@ spec:
216227
---
217228
{{- end }}
218229
{{- end }}
219-
{{- end }}
230+
{{- end }}

charts/team-ns/templates/tekton-tasks/buildpacks.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ metadata:
66
labels:
77
app.kubernetes.io/version: "0.6"
88
annotations:
9+
# Use ArgoCD sync wave annotation to ensure tasks are created first
10+
argocd.argoproj.io/sync-wave: "-5"
911
tekton.dev/categories: Image Build
1012
tekton.dev/pipelines.minVersion: "0.17.0"
1113
tekton.dev/tags: image-build

charts/team-ns/templates/tekton-tasks/git-clone.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ apiVersion: tekton.dev/v1
33
kind: Task
44
metadata:
55
name: git-clone
6-
labels:
7-
app.kubernetes.io/version: "0.9"
86
annotations:
7+
# Use ArgoCD sync wave annotation to ensure tasks are created first
8+
argocd.argoproj.io/sync-wave: "-5"
99
tekton.dev/pipelines.minVersion: "0.38.0"
1010
tekton.dev/categories: Git
1111
tekton.dev/tags: git
1212
tekton.dev/displayName: "git clone"
1313
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
14+
labels:
15+
app.kubernetes.io/version: "0.9"
1416
spec:
1517
stepTemplate:
1618
computeResources:

charts/team-ns/templates/tekton-tasks/grype.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ apiVersion: tekton.dev/v1
33
kind: Task
44
metadata:
55
name: grype
6-
labels:
7-
app.kubernetes.io/version: "0.1"
86
annotations:
7+
# Use ArgoCD sync wave annotation to ensure tasks are created first
8+
argocd.argoproj.io/sync-wave: "-5"
99
tekton.dev/pipelines.minVersion: "0.12.1"
1010
tekton.dev/categories: Security
1111
tekton.dev/tags: CLI, grype
1212
tekton.dev/displayName: "grype"
1313
tekton.dev/platforms: "linux/amd64,linux/arm64,linux/ppc64le,linux/390x"
14+
labels:
15+
app.kubernetes.io/version: "0.1"
1416
spec:
1517
stepTemplate:
1618
computeResources:

charts/team-ns/templates/tekton-tasks/kaniko.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ metadata:
66
labels:
77
app.kubernetes.io/version: "0.6"
88
annotations:
9+
# ArgoCD sync wave annotation to ensure it's applied first
10+
argocd.argoproj.io/sync-wave: "-5"
911
tekton.dev/pipelines.minVersion: "0.17.0"
1012
tekton.dev/categories: Image Build
1113
tekton.dev/tags: image-build

0 commit comments

Comments
 (0)