Skip to content

Commit 429e996

Browse files
author
edge-katanomi-app2[bot]
committed
📚 Sync docs from alaudadevops/tektoncd-operator on 4fc365f2790966f7cf86854143e7bbbb012d4f8a
Source: feat: [DEVOPS-41997] add docs for helm task (#450) Author: yzc Ref: refs/heads/main Commit: 4fc365f2790966f7cf86854143e7bbbb012d4f8a This commit automatically syncs documentation changes from the source-docs repository. 🔗 View source commit: https://github.com/alaudadevops/tektoncd-operator/commit/4fc365f2790966f7cf86854143e7bbbb012d4f8a 🤖 Synced on 2025-09-04 14:44:52 UTC
1 parent 1255be5 commit 429e996

16 files changed

+1218
-222
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-09-03 07:02:13 UTC
3+
- **Last synced**: 2025-09-04 14:44:52 UTC
44
- **Source repository**: alaudadevops/tektoncd-operator
5-
- **Source commit**: [cfde35b20eb66038dd56b0fe4fb61bc82e5d4ef5](https://github.com/alaudadevops/tektoncd-operator/commit/cfde35b20eb66038dd56b0fe4fb61bc82e5d4ef5)
6-
- **Triggered by**: tik-seven
7-
- **Workflow run**: [#44](https://github.com/alaudadevops/tektoncd-operator/actions/runs/17425687592)
5+
- **Source commit**: [4fc365f2790966f7cf86854143e7bbbb012d4f8a](https://github.com/alaudadevops/tektoncd-operator/commit/4fc365f2790966f7cf86854143e7bbbb012d4f8a)
6+
- **Triggered by**: edge-katanomi-app2[bot]
7+
- **Workflow run**: [#45](https://github.com/alaudadevops/tektoncd-operator/actions/runs/17467670871)
88

99
## Files synced:
1010
- docs/
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
---
2+
weight: 53
3+
i18n:
4+
title:
5+
en: Deploy/Upgrade from Helm Charts in Git Repo
6+
zh: 使用 Git 仓库中的 Helm Chart 部署/升级
7+
title: Deploy/Upgrade from Helm Charts in Git Repo
8+
---
9+
10+
# Deploy/Upgrade from Helm Charts in Git Repo
11+
12+
This guide shows a practical CI/CD flow where your Helm charts live under a `charts/` directory in your Git repo.
13+
14+
We'll use Pipeline to:
15+
16+
1. Clone the repository with the `git-clone` Task
17+
2. Deploy/upgrade a target chart with Helm (`helm upgrade --install`)
18+
19+
You'll Build a reusable Pipeline named `helm-deploy-from-git-repo` that:
20+
21+
1. Pulls your repo
22+
2. Runs `helm dependency build` (so subcharts are fetched)
23+
3. Runs `helm upgrade --install` for a chart at `charts/<name>` (or any subpath you choose)
24+
4. Supports `--wait`, `--timeout`, `--atomic`, extra args, multiple values files, and `--set` kv pairs
25+
26+
## Prerequisites
27+
28+
* A Kubernetes cluster (you can use minikube for local testing).
29+
* Tekton Pipelines installed on your cluster.
30+
* A Helm 3.8+ container image (Helm v3 with OCI support).
31+
* A Git repository that contains a valid Helm chart (directory with `Chart.yaml`, `templates/`, `values.yaml`).
32+
* Git access to the repository:
33+
* Public repo: nothing special.
34+
* Private repo: create a Git credential Secret (SSH or basic-auth).
35+
* Cluster access for Helm (choose one):
36+
* Mount a Kubeconfig Secret,
37+
* Run the Task under a ServiceAccount with sufficient RBAC.
38+
39+
## Step-by-Step Instructions
40+
41+
### Step 1: Create Cluster Access Credential
42+
43+
You need a cluster access credential for Helm.
44+
45+
You can refer to the [Prepare Cluster Access Credential](../prepare/prepare_cluster_access_credential.mdx).
46+
47+
### Step 2: Prepare helm image
48+
49+
You need a Helm 3.8+ container image (Helm v3 with OCI support) to run the `helm` command.
50+
51+
You can refer to the [Discover Tool Image](../prepare/discover_tool_image.mdx).
52+
53+
When searching by label, specify the image as `helm`, for example: `-l operator.tekton.dev/tool-image=helm`.
54+
55+
### Step 3: Define the Pipeline
56+
57+
This Pipeline uses `git-clone` to fetch your repo, then calls `helm` to install or upgrade your chart.
58+
59+
You can use `--wait` to blocks until Kubernetes reports the release's resources are ready (or until the operation times out).
60+
Pair it with `--timeout` to control how long Helm will wait.
61+
62+
It's common to combine with `--atomic`, which rolls back automatically if the wait fails or times out—so you don't leave a half-upgraded release.
63+
64+
**Please replace `<helm-image>` with your Helm image.**
65+
66+
```yaml
67+
apiVersion: tekton.dev/v1
68+
kind: Pipeline
69+
metadata:
70+
name: helm-deploy-from-git-repo
71+
spec:
72+
description: Clone repo, package Helm chart, and push to an OCI registry.
73+
params:
74+
- name: repo_url
75+
type: string
76+
description: Git URL of your repository
77+
- name: revision
78+
type: string
79+
description: Git revision (branch, tag, or SHA)
80+
default: main
81+
- name: chart_dir
82+
type: string
83+
description: Path to the Helm chart in the repo
84+
default: "."
85+
- name: release_name
86+
type: string
87+
description: Helm release name
88+
- name: namespace
89+
type: string
90+
description: Target namespace
91+
default: default
92+
- name: extra_args
93+
type: string
94+
description: Extra helm args (e.g., "--atomic --timeout 5m --set key=val -f values.yaml")
95+
default: ""
96+
workspaces:
97+
- name: source
98+
- name: basic-auth
99+
optional: true
100+
- name: kubeconfig
101+
optional: true
102+
tasks:
103+
- name: git-clone
104+
taskRef:
105+
resolver: hub
106+
params:
107+
- name: catalog
108+
value: catalog
109+
- name: kind
110+
value: task
111+
- name: name
112+
value: git-clone
113+
- name: version
114+
value: "0.9"
115+
workspaces:
116+
- name: output
117+
workspace: source
118+
- name: basic-auth
119+
workspace: basic-auth
120+
params:
121+
- name: url
122+
value: $(params.repo_url)
123+
- name: revision
124+
value: $(params.revision)
125+
- name: helm
126+
runAfter:
127+
- "git-clone"
128+
taskRef:
129+
resolver: hub
130+
params:
131+
- name: catalog
132+
value: catalog
133+
- name: kind
134+
value: task
135+
- name: name
136+
value: run-script
137+
- name: version
138+
value: "0.1"
139+
workspaces:
140+
- name: source
141+
workspace: source
142+
- name: secret
143+
workspace: kubeconfig
144+
params:
145+
- name: image
146+
## Replace with your Helm image
147+
value: <helm-image>
148+
- name: script
149+
value: |
150+
set -e
151+
152+
if [ "$(workspaces.secret.bound)" = "true" ]; then
153+
echo "Using kubeconfig in $(workspaces.secret.path)"
154+
export KUBECONFIG=$(workspaces.secret.path)/kubeconfig
155+
fi
156+
157+
echo "Build chart dependencies (if any)…"
158+
helm dependency build "$(params.chart_dir)"
159+
160+
echo "Upgrading/Installing release..."
161+
echo " Release: $(params.release_name)"
162+
echo " Namespace: $(params.namespace)"
163+
echo " Chart: $(params.chart_dir)"
164+
165+
# Direct install from OCI (no need to helm pull first)
166+
helm upgrade --install "$(params.release_name)" "$(params.chart_dir)" \
167+
--namespace "$(params.namespace)" --create-namespace \
168+
$(params.extra_args)
169+
170+
echo "Done."
171+
```
172+
173+
### Step 4: Run It with a PipelineRun
174+
175+
* Cluster access for Helm (choose one):
176+
* Mount a Kubeconfig Secret,
177+
* Run the Task under a ServiceAccount with sufficient RBAC.
178+
179+
Please choose one of cluster access credentials.
180+
181+
```yaml
182+
apiVersion: tekton.dev/v1
183+
kind: PipelineRun
184+
metadata:
185+
generateName: helm-deploy-from-git-repo-
186+
spec:
187+
workspaces:
188+
- name: source
189+
volumeClaimTemplate:
190+
spec:
191+
accessModes:
192+
- ReadWriteOnce
193+
resources:
194+
requests:
195+
storage: 1Gi
196+
- name: basic-auth
197+
secret:
198+
secretName: basic-auth
199+
200+
## If you choose to use the kubeconfig Secret
201+
# - name: kubeconfig
202+
# secret:
203+
# secretName: <kubeconfig-secret-name>
204+
205+
params:
206+
- name: repo_url
207+
value: https://github.com/your-org/your-repo.git
208+
- name: revision
209+
value: main
210+
- name: chart_dir
211+
value: .
212+
- name: release_name
213+
value: myapp
214+
- name: namespace
215+
value: my-namespace
216+
pipelineRef:
217+
name: helm-deploy-from-git-repo
218+
219+
## If you choose to use the ServiceAccount
220+
# taskRunTemplate:
221+
# serviceAccountName: <service-account-name>
222+
```
223+
224+
## Troubleshooting
225+
226+
- **`helm: command not found`**: Ensure your `image` actually contains the Helm binary.
227+
- **`failed to create resource: (…RBAC…) forbidden`**: The kubeconfig/ServiceAccount lacks permissions. Grant the necessary roles to create/update the resources the chart manages.
228+
229+
## Next Steps
230+
231+
- [Specifying remote tasks using hub resolvers](../../pipelines/how_to/specifying_remote_tasks_using_hub_resolvers.mdx)
232+
- [Package & Push a Helm Chart to an OCI Registry](./package_and_push_helm_chart.mdx)
233+
- [Deploy/Upgrade from an OCI-hosted Helm Chart](./deploy_or_upgrade_by_helm_chart_in_registry.mdx)

0 commit comments

Comments
 (0)