|
| 1 | +# Component Update Guide |
| 2 | + |
| 3 | +This document describes how to update components in the TektonCD Operator project using the automated update system. The project now uses an automated script to download and process component releases, eliminating the need for manual updates. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The automated component update process includes the following steps: |
| 8 | +1. Configure component information in `components.yaml` |
| 9 | +2. Run the automated update script to download and process components |
| 10 | +3. Review and commit changes |
| 11 | + |
| 12 | +## Step 1: Configure Components in components.yaml |
| 13 | + |
| 14 | +All component configurations are managed in the `components.yaml` file at the project root. This file defines: |
| 15 | +- Component names and their revision/branch |
| 16 | +- Remote paths for downloading release artifacts |
| 17 | +- Local paths for organizing downloaded files |
| 18 | +- Custom file names if needed |
| 19 | + |
| 20 | +### 1.1 Current Component Configuration |
| 21 | + |
| 22 | +```yaml |
| 23 | +tektoncd-pipeline: |
| 24 | + revision: main |
| 25 | + releases: |
| 26 | + - remote_path: pipeline |
| 27 | + local_path: tekton-pipeline |
| 28 | + |
| 29 | +tektoncd-hub: |
| 30 | + revision: main |
| 31 | + releases: |
| 32 | + - remote_path: api |
| 33 | + local_path: tekton-hub/api |
| 34 | + - remote_path: hub-info |
| 35 | + local_path: tekton-hub/hub-info |
| 36 | + |
| 37 | +tektoncd-trigger: |
| 38 | + revision: main |
| 39 | + releases: |
| 40 | + - remote_path: trigger |
| 41 | + local_path: tekton-triggers |
| 42 | + - remote_path: bindings |
| 43 | + local_path: tekton-triggers |
| 44 | + local_name: bindings.yaml |
| 45 | +``` |
| 46 | +
|
| 47 | +### 1.2 Configuration Fields Explained |
| 48 | +
|
| 49 | +- **`revision`**: The Git branch or commit hash to pull releases from |
| 50 | +- **`releases`**: Array of release artifacts to download |
| 51 | + - **`remote_path`**: Path in the remote repository (e.g., `api`, `pipeline`) |
| 52 | + - **`local_path`**: Local directory structure for organizing files |
| 53 | + - **`local_sub_path`**: (Optional) Subdirectory within the local path, the final dir will be "${local_path}/${version}/${local_sub_path}" |
| 54 | + - **`local_name`**: (Optional) Custom filename (defaults to `release.yaml`) |
| 55 | + |
| 56 | +## Step 2: Run Automated Update Process |
| 57 | + |
| 58 | +### 2.1 Using make update-components |
| 59 | + |
| 60 | +The project provides a `make` target to run the automated update process: |
| 61 | + |
| 62 | +```bash |
| 63 | +# Run the complete automated update process |
| 64 | +make update-components |
| 65 | +``` |
| 66 | + |
| 67 | +This command will: |
| 68 | +1. Download all component values and release files |
| 69 | +2. Extract version information from values files |
| 70 | +3. Process files with kustomize |
| 71 | +4. Merge component images into the project's `values.yaml` |
| 72 | + |
| 73 | +### 2.2 Specifying Custom Branch/Revision |
| 74 | + |
| 75 | +To use releases from your own branch or specific commit: |
| 76 | + |
| 77 | +1. **Edit components.yaml**: Update the `revision` field for the component you want to update: |
| 78 | + |
| 79 | +```yaml |
| 80 | +tektoncd-hub: |
| 81 | + revision: your-feature-branch # or specific commit hash |
| 82 | + releases: |
| 83 | + - remote_path: api |
| 84 | + local_path: tekton-hub/api |
| 85 | + - remote_path: hub-info |
| 86 | + local_path: tekton-hub/hub-info |
| 87 | +``` |
| 88 | + |
| 89 | +2. **Run the update process**: |
| 90 | + |
| 91 | +```bash |
| 92 | +make update-components |
| 93 | +``` |
| 94 | + |
| 95 | +### 2.3 Update Process Details |
| 96 | + |
| 97 | +The automated script performs the following operations: |
| 98 | + |
| 99 | +1. **Download Phase**: Downloads all component files from the specified revision |
| 100 | +2. **Image Replacement Phase**: Updates catalog image references |
| 101 | +3. **Rendering Phase**: Processes files with kustomize and organizes them by version |
| 102 | +4. **Image Merging Phase**: Extracts and merges component images into `values.yaml` |
| 103 | + |
| 104 | +## Step 3: Adding New Components |
| 105 | + |
| 106 | +### 3.1 Adding a Component Entry |
| 107 | + |
| 108 | +To add a new component to the automated update process: |
| 109 | + |
| 110 | +1. **Add component configuration** to `components.yaml`: |
| 111 | + |
| 112 | +```yaml |
| 113 | +your-new-component: |
| 114 | + revision: main # or your target branch |
| 115 | + releases: |
| 116 | + - remote_path: main |
| 117 | + local_path: your-component/main |
| 118 | + - remote_path: sidecar |
| 119 | + local_path: your-component/sidecar |
| 120 | + local_name: sidecar.yaml |
| 121 | +``` |
| 122 | + |
| 123 | +2. **Run the update process**: |
| 124 | + |
| 125 | +```bash |
| 126 | +make update-components |
| 127 | +``` |
| 128 | + |
| 129 | +### 3.2 Component Structure Requirements |
| 130 | + |
| 131 | +For a component to work with the automated system, it must: |
| 132 | + |
| 133 | +1. **Have a values/release.yaml file** containing: |
| 134 | + - `global.version` field with version information |
| 135 | + - `global.images` section with component images |
| 136 | + |
| 137 | +2. **Provide release artifacts** at the specified remote paths |
| 138 | + |
| 139 | +3. **Follow the expected URL structure**: |
| 140 | + ``` |
| 141 | + https://build-nexus.alauda.cn/repository/alauda/devops/tektoncd-releases/{component}/{revision}/{remote_path}/release.yaml |
| 142 | + ``` |
| 143 | + |
| 144 | +### 3.3 Example: Adding a New Tekton Component |
| 145 | + |
| 146 | +```yaml |
| 147 | +tektoncd-new-component: |
| 148 | + revision: v0.1.0 |
| 149 | + releases: |
| 150 | + - remote_path: controller |
| 151 | + local_path: tekton-new-component/controller |
| 152 | + - remote_path: webhook |
| 153 | + local_path: tekton-new-component/webhook |
| 154 | + - remote_path: cli |
| 155 | + local_path: tekton-new-component/cli |
| 156 | + local_name: cli.yaml |
| 157 | +``` |
| 158 | + |
| 159 | +## Step 4: Review and Commit Changes |
| 160 | + |
| 161 | +### 4.1 Verify Generated Files |
| 162 | + |
| 163 | +After running the update process, verify the generated files: |
| 164 | + |
| 165 | +```bash |
| 166 | +# Check updated values.yaml |
| 167 | +grep -A 5 "your-component" values.yaml |
| 168 | +
|
| 169 | +# Verify generated manifest files |
| 170 | +ls -la .ko/operator/kodata/your-component/ |
| 171 | +
|
| 172 | +# Check component images were merged |
| 173 | +yq '.global.images' values.yaml |
| 174 | +``` |
| 175 | + |
| 176 | +### 4.2 Test the updates |
| 177 | + |
| 178 | +Ensure the updated configuration works correctly: |
| 179 | + |
| 180 | +```bash |
| 181 | +# Run tests |
| 182 | +make test |
| 183 | +
|
| 184 | +# Build the project |
| 185 | +make build |
| 186 | +``` |
| 187 | + |
| 188 | +### 4.3 Commit Changes |
| 189 | + |
| 190 | +Commit the automated updates: |
| 191 | + |
| 192 | +```bash |
| 193 | +# Add all generated files |
| 194 | +git add values.yaml .ko/operator/kodata/ config/ |
| 195 | +
|
| 196 | +# Commit with descriptive message |
| 197 | +git commit -m "feat: update components via automated update |
| 198 | +
|
| 199 | +- Update tektoncd-hub to v1.19.2 |
| 200 | +- Update tektoncd-pipeline to v0.65.5 |
| 201 | +- Merge component images into values.yaml |
| 202 | +- Generated by automated build system" |
| 203 | +``` |
| 204 | + |
| 205 | +## Update Output Structure |
| 206 | + |
| 207 | +The automated update process generates the following structure: |
| 208 | + |
| 209 | +``` |
| 210 | +.ko/operator/kodata/ |
| 211 | +├── tekton-hub/ |
| 212 | +│ └── 1.19.2/ |
| 213 | +│ ├── api/ |
| 214 | +│ │ └── release.yaml |
| 215 | +│ └── hub-info/ |
| 216 | +│ └── release.yaml |
| 217 | +├── tekton-pipeline/ |
| 218 | +│ └── 0.65.5/ |
| 219 | +│ └── pipeline/ |
| 220 | +│ └── release.yaml |
| 221 | +└── ... |
| 222 | +
|
| 223 | +config/ |
| 224 | +├── values/ |
| 225 | +│ ├── tektoncd-hub-release.yaml |
| 226 | +│ ├── tektoncd-pipeline-release.yaml |
| 227 | +│ └── ... |
| 228 | +└── tekton-hub/ |
| 229 | + ├── api/ |
| 230 | + │ └── release.yaml |
| 231 | + └── hub-info/ |
| 232 | + └── release.yaml |
| 233 | +``` |
| 234 | + |
| 235 | +## Troubleshooting |
| 236 | + |
| 237 | +### Common Issues |
| 238 | + |
| 239 | +1. **Download Failures**: Check if the component revision exists and has the expected release artifacts |
| 240 | +2. **Version Extraction Issues**: Ensure the component's values file has a valid `global.version` field |
| 241 | +3. **Kustomize Build Failures**: Verify the downloaded files contain valid kustomize configurations |
| 242 | +4. **Image Merge Issues**: Check that component values files have a `global.images` section |
| 243 | + |
| 244 | +### Debug Commands |
| 245 | + |
| 246 | +```bash |
| 247 | +# Check component configuration |
| 248 | +yq 'keys' components.yaml |
| 249 | +
|
| 250 | +# Verify downloaded files |
| 251 | +ls -la config/values/ |
| 252 | +ls -la config/tekton-*/ |
| 253 | +
|
| 254 | +# Check version extraction |
| 255 | +yq '.global.version' config/values/tektoncd-hub-release.yaml |
| 256 | +
|
| 257 | +# Verify image merging |
| 258 | +yq '.global.images' values.yaml |
| 259 | +``` |
| 260 | + |
| 261 | +## Migration from Manual Updates |
| 262 | + |
| 263 | +If you were previously updating components manually: |
| 264 | + |
| 265 | +1. **Remove manual configurations** from `values.yaml` that are now handled by the automated system |
| 266 | +2. **Update components.yaml** to include all components you were manually managing |
| 267 | +3. **Run the automated update** to generate the new structure |
| 268 | +4. **Remove old manual files** that are no longer needed |
| 269 | + |
| 270 | +## Important Notes |
| 271 | + |
| 272 | +1. **Version Management**: The automated system extracts versions from component values files |
| 273 | +2. **Image Deduplication**: Component images are automatically merged with prefixes to avoid conflicts |
| 274 | +3. **Branch Flexibility**: You can easily switch between branches by updating the `revision` field |
| 275 | +4. **Rollback**: Use Git to rollback to previous commits if needed |
| 276 | + |
| 277 | +## Related Documentation |
| 278 | + |
| 279 | +- [Component Configuration Reference](../configure/components.yaml.md) |
| 280 | +- [Build System Architecture](../architecture/build-system.md) |
| 281 | +- [Development Environment Setup](../component-quickstart/index.md) |
0 commit comments