You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/pipelines/how_to/use-java-image-build-scan-deploy-pipeline.mdx
+61-13Lines changed: 61 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,7 @@ spec:
118
118
- **build-extra-args**
119
119
- **type**: string
120
120
- **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).
122
122
123
123
- **build-args**
124
124
- **type**: array
@@ -133,7 +133,7 @@ spec:
133
133
- **push-extra-args**
134
134
- **type**: string
135
135
- **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).
137
137
138
138
### Trivy Scanner
139
139
@@ -145,34 +145,39 @@ spec:
145
145
- **trivy-extra-args**
146
146
- **type**: string
147
147
- **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.
149
149
150
-
### Update Workload
150
+
### Deploy or upgrade workload
151
151
152
152
- **workload-name**
153
153
- **type**: string
154
154
- **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.
156
156
157
157
- **workload-kind**
158
158
- **type**: string
159
159
- **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.
161
161
162
162
- **workload-namespace**
163
163
- **type**: string
164
164
- **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.
166
166
167
167
- **workload-container**
168
168
- **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.
171
171
172
172
- **workload-rollout-timeout**
173
173
- **type**: string
174
174
- **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".
176
181
177
182
## Workspaces
178
183
@@ -196,7 +201,7 @@ The Task can be run on `linux/amd64` and `linux/arm64` platforms.
196
201
197
202
### Minimal Setup: Run End-to-End With Minimal Parameters
198
203
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.
200
205
201
206
```yaml
202
207
apiVersion: tekton.dev/v1
@@ -289,6 +294,49 @@ Here is some of the properties you can set:
289
294
| sonar.sources | Comma-separated paths to directories containing main source files |
290
295
| sonar.organization | The organization in SonarQube where the project exists |
291
296
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
+
292
340
### Skip tasks with Params
293
341
294
342
The pipeline supports skipping tasks using params:
@@ -298,7 +346,7 @@ The pipeline supports skipping tasks using params:
298
346
| git-clone | `skip-git-clone` | `"false"` | If code already exists in `source` workspace, you can set this to `"true"` to skip cloning. |
299
347
| sonarqube-scanner | `sonar-url` | `""` | Scan will be skipped if `sonar-url` is not set. |
300
348
| 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. |
302
350
303
351
### Full Example with All Tasks
304
352
@@ -309,7 +357,7 @@ This example demonstrates how to use all tasks in the pipeline. It includes foll
309
357
* Building the image and pushing the image to the registry.
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}
[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.
0 commit comments