Skip to content

Commit 8cf3b3e

Browse files
committed
📚 Sync docs from alaudadevops/tektoncd-operator on d9a71adfda077eb458d051aac93f41addfce332e
Source: [DEVOPS-37117] feat: java pipeline support deploy workload docs Author: yzc Ref: refs/heads/main Commit: d9a71adfda077eb458d051aac93f41addfce332e This commit automatically syncs documentation changes from the source-docs repository. 🔗 View source commit: AlaudaDevops/tektoncd-operator@d9a71ad 🤖 Synced on 2025-07-07 03:52:51 UTC
1 parent 468aa4f commit 8cf3b3e

File tree

3 files changed

+142
-17
lines changed

3 files changed

+142
-17
lines changed

.github/SYNC_INFO.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Documentation Sync Information
22

3-
- **Last synced**: 2025-07-05 07:35:23 UTC
3+
- **Last synced**: 2025-07-07 03:52:51 UTC
44
- **Source repository**: alaudadevops/tektoncd-operator
5-
- **Source commit**: [ec48bfab09387e492f3a8055666fd5aa11526573](https://github.com/alaudadevops/tektoncd-operator/commit/ec48bfab09387e492f3a8055666fd5aa11526573)
6-
- **Triggered by**: l-qing
7-
- **Workflow run**: [#8](https://github.com/alaudadevops/tektoncd-operator/actions/runs/16085926886)
5+
- **Source commit**: [d9a71adfda077eb458d051aac93f41addfce332e](https://github.com/alaudadevops/tektoncd-operator/commit/d9a71adfda077eb458d051aac93f41addfce332e)
6+
- **Triggered by**: yuzichen12123
7+
- **Workflow run**: [#9](https://github.com/alaudadevops/tektoncd-operator/actions/runs/16107170334)
88

99
## Files synced:
1010
- docs/

docs/en/pipelines/how_to/use-java-image-build-scan-deploy-pipeline.mdx

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ spec:
118118
- **build-extra-args**
119119
- **type**: string
120120
- **default**: ""
121-
- **description**: Extra parameters passed for the build command when building images. WARNING - must be sanitized to avoid command injection. e.g., --build-arg key=value --label key=value
121+
- **description**: Extra parameters passed for the build command when building images. WARNING - must be sanitized to avoid command injection (e.g. --build-arg key=value --label key=value).
122122

123123
- **build-args**
124124
- **type**: array
@@ -133,7 +133,7 @@ spec:
133133
- **push-extra-args**
134134
- **type**: string
135135
- **default**: ""
136-
- **description**: Extra parameters passed for the push command when pushing images. WARNING - must be sanitized to avoid command injection. e.g., --creds=username:password
136+
- **description**: Extra parameters passed for the push command when pushing images. WARNING - must be sanitized to avoid command injection (e.g. --creds=username:password).
137137

138138
### Trivy Scanner
139139

@@ -145,34 +145,39 @@ spec:
145145
- **trivy-extra-args**
146146
- **type**: string
147147
- **default**: ""
148-
- **description**: Extra parameters passed for the trivy command when scanning images. WARNING - must be sanitized to avoid command injection. e.g., --insecure. You can use `--skip-db-update` `--skip-java-db-update` to skip updating vulnerability database.
148+
- **description**: Extra parameters passed for the trivy command when scanning images. WARNING - must be sanitized to avoid command injection (e.g. --insecure). You can use `--skip-db-update` `--skip-java-db-update` to skip updating vulnerability database.
149149

150-
### Update Workload
150+
### Deploy or upgrade workload
151151

152152
- **workload-name**
153153
- **type**: string
154154
- **default**: ""
155-
- **description**: The name of the workload to update.
155+
- **description**: The name of the workload to deploy or upgrade. If it is not specified, `deploy-or-upgrade` task will be skipped.
156156

157157
- **workload-kind**
158158
- **type**: string
159159
- **default**: Deployment
160-
- **description**: The kind of workload to update, such as Deployment, StatefulSet, etc.
160+
- **description**: The kind of workload to deploy or upgrade, such as Deployment, StatefulSet, etc.
161161

162162
- **workload-namespace**
163163
- **type**: string
164164
- **default**: ""
165-
- **description**: The namespace of the workload to update. If not specified, will use the namespace of the current TaskRun.
165+
- **description**: The namespace of the workload to deploy or upgrade. If not specified, will use the namespace of the current TaskRun.
166166

167167
- **workload-container**
168168
- **type**: string
169-
- **default**: "*"
170-
- **description**: This parameter is used to specify the container within the workload whose image needs to be updated. By default, the images of all containers in the workload will be updated.
169+
- **default**: []
170+
- **description**: This parameter is used to specify the containers within the workload whose image needs to be updated. By default, all of the container's image in the workload will be updated.
171171

172172
- **workload-rollout-timeout**
173173
- **type**: string
174174
- **default**: "0"
175-
- **description**: The timeout for the rollout to complete. If it is not specified or set to 0, it will never timeout.
175+
- **description**: The length of time to wait before ending waiting workload ready, `0` means never. Any other values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
176+
177+
- **workload-manifests-dir**
178+
- **type**: string
179+
- **default**: ""
180+
- **description**: The manifest of the workload to deploy. If it is not specified, will only update the image of the workload which is already in cluster. You can use the relative path to the manifest directory in the `source` workspace. For example: "manifests".
176181

177182
## Workspaces
178183

@@ -196,7 +201,7 @@ The Task can be run on `linux/amd64` and `linux/arm64` platforms.
196201

197202
### Minimal Setup: Run End-to-End With Minimal Parameters
198203

199-
Optional tasks (sonarqube-scanner, update-workload, etc.) will be gracefully skipped when unset or omitted.
204+
Optional tasks (`sonarqube-scanner`, `deploy-or-upgrade`, etc.) will be gracefully skipped when unset or omitted.
200205

201206
```yaml
202207
apiVersion: tekton.dev/v1
@@ -289,6 +294,49 @@ Here is some of the properties you can set:
289294
| sonar.sources | Comma-separated paths to directories containing main source files |
290295
| sonar.organization | The organization in SonarQube where the project exists |
291296

297+
### Deploy or upgrade a workload
298+
299+
You can deploy or upgrade a workload using the image built by the `build-image` task in this pipeline.
300+
301+
By setting the `workload-manifests-dir` param, you can apply Kubernetes manifests from the specified directory to create or update the workload.
302+
303+
Both JSON and YAML formats are supported. All manifests within the specified directory will be processed using `kubectl apply`. Note that `kubectl apply` does not traverse subdirectories.
304+
305+
If the directory contains a Kustomize configuration file (e.g. `kustomization.yaml`, `kustomization.yml`, or `Kustomization`), it will be processed using `kubectl kustomize`.
306+
307+
Here is an example structure of the `workload-manifests-dir`:
308+
309+
```
310+
manifests
311+
├── deployment.yaml
312+
├── kustomization.yaml
313+
└── service.yaml
314+
```
315+
316+
You can configure the following parameters:
317+
318+
```yaml
319+
spec:
320+
params:
321+
# ...
322+
- name: images
323+
value:
324+
- foo/bar:latest
325+
- name: workload-name
326+
value: bar
327+
- name: workload-namespace
328+
value: default
329+
- name: workload-kind
330+
value: Deployment
331+
- name: workload-manifests-dir
332+
value: manifests
333+
# ...
334+
```
335+
336+
If you prefer not to deploy the workload using manifests. Simply leave the `workload-manifests-dir` param empty. In that case, the task will only update the image of an existing workload in the cluster.
337+
338+
You need to manage image pull secrets for the workload. If the new image is hosted in a different registry, make sure to create and configure the appropriate pull secret for your workload.
339+
292340
### Skip tasks with Params
293341

294342
The pipeline supports skipping tasks using params:
@@ -298,7 +346,7 @@ The pipeline supports skipping tasks using params:
298346
| git-clone | `skip-git-clone` | `"false"` | If code already exists in `source` workspace, you can set this to `"true"` to skip cloning. |
299347
| sonarqube-scanner | `sonar-url` | `""` | Scan will be skipped if `sonar-url` is not set. |
300348
| trivy-scanner | `skip-trivy-scan` | `"false"` | Scan will be skipped if `skip-trivy-scan` is set to `"true"`. |
301-
| update-workload | `workload-name` | `""` | If you don't want to update the workload, you can left `workload-name` empty. |
349+
| deploy-or-upgrade | `workload-name` | `""` | If you don't want to deploy or upgrade the workload, you can left `workload-name` empty. |
302350

303351
### Full Example with All Tasks
304352

@@ -309,7 +357,7 @@ This example demonstrates how to use all tasks in the pipeline. It includes foll
309357
* Building the image and pushing the image to the registry.
310358
* Scanning the image with Trivy
311359
* Scanning the code with SonarQube
312-
* Updating the workload
360+
* Deploying or Upgrading the workload
313361

314362
```yaml
315363
apiVersion: tekton.dev/v1
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
weight: 10
3+
i18n:
4+
title:
5+
en: Unable to Use Multiple PVC Workspaces in Tekton
6+
zh: 在 Tekton 中遇到无法使用多个基于 PVC 的工作区的问题
7+
title:
8+
---
9+
10+
# Unable to Use Multiple PVC Workspaces in Tekton
11+
12+
## Problem Description
13+
14+
When running a `PipelineRun` or `TaskRun` in Tekton with **multiple `PersistentVolumeClaim` (PVC)**-based `workspaces`, the execution fails with an error similar to "more than one PersistentVolumeClaim is bound".
15+
16+
This occurs even if all PVCs are valid and correctly declared.
17+
18+
### Error Manifestation
19+
20+
1. TaskRun execution fails with a status of `False`, and the reason is `TaskRunValidationFailed`:
21+
```bash
22+
$ kubectl get taskruns -n ${namespace} ${taskrun_name}
23+
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
24+
demo-hbfhd-foo False TaskRunValidationFailed 59s 59s
25+
```
26+
27+
2. The TaskRun event displays an error message:
28+
```
29+
[User error] more than one PersistentVolumeClaim is bound
30+
```
31+
32+
## Root Cause Analysis
33+
34+
By default, Tekton enables the **Affinity Assistant** feature to help co-locate TaskRun pods with their PVCs on the same node. This is especially useful for volumes with `ReadWriteOnce` access mode.
35+
36+
However, when the Affinity Assistant is enabled:
37+
- Each `TaskRun` is limited to a **single PVC-based workspace**.
38+
- Binding more than one PVC triggers a **validation error**, preventing the TaskRun from running.
39+
40+
This restriction is enforced to avoid complex scheduling issues and node affinity conflicts.
41+
42+
## Troubleshooting
43+
44+
To allow a `TaskRun` or `PipelineRun` to use **multiple PVC-based workspaces**, you must **disable the Affinity Assistant** by updating the Tekton feature flags.
45+
46+
It is recommended to troubleshoot as follows:
47+
48+
1. Edit the TektonConfig resource by setting `spec.pipeline.disable-affinity-assistant` as shown below:
49+
50+
```yaml
51+
apiVersion: operator.tekton.dev/v1alpha1
52+
kind: TektonConfig
53+
spec:
54+
pipeline:
55+
disable-affinity-assistant: true
56+
```
57+
58+
tips: the `disable-affinity-assistant` feature flag will be removed soon and the Affinity Assistant Modes will be only controlled by the `coschedule` feature flag.
59+
60+
2. The `feature-flags` ConfigMap will be updated automatically.
61+
62+
```yaml
63+
apiVersion: v1
64+
kind: ConfigMap
65+
metadata:
66+
name: feature-flags
67+
namespace: tekton-pipelines
68+
data:
69+
disable-affinity-assistant: "true"
70+
```
71+
72+
3. No manual component restarts are required, changes will take effect automatically.
73+
74+
## Related Content
75+
76+
- [Tekton Affinity Assistant](https://tekton.dev/docs/pipelines/affinityassistants/)
77+
- [Tekton Workspaces](https://tekton.dev/docs/pipelines/workspaces/)

0 commit comments

Comments
 (0)