|
| 1 | +--- |
| 2 | +name: upgrading-chart |
| 3 | +description: Upgrades Helm chart dependencies (PostgreSQL, Vault) in the Chainloop project, including vendorized charts, container images, and CI/CD workflows. Use when the user mentions upgrading Helm charts, Bitnami dependencies, PostgreSQL chart, or Vault chart. CRITICAL - Major version upgrades are FORBIDDEN and must be escalated. |
| 4 | +--- |
| 5 | + |
| 6 | +# Upgrading Helm Chart Dependencies |
| 7 | + |
| 8 | +This skill automates the upgrade process for Helm chart dependencies in the Chainloop project. Supports PostgreSQL and Vault (both Bitnami charts). |
| 9 | + |
| 10 | +## CRITICAL RESTRICTIONS |
| 11 | + |
| 12 | +**Version Upgrade Rules**: |
| 13 | +- Patch upgrades (1.2.3 → 1.2.4): ALLOWED |
| 14 | +- Minor upgrades (1.2.x → 1.3.x): ALLOWED |
| 15 | +- Major upgrades (1.x.x → 2.x.x): **FORBIDDEN - STOP IMMEDIATELY** |
| 16 | + |
| 17 | +**MANDATORY**: If major version upgrade is detected, STOP the process and inform the user that manual review is required. |
| 18 | + |
| 19 | +## Upgrade Types |
| 20 | + |
| 21 | +The skill supports two upgrade types: |
| 22 | + |
| 23 | +1. **Specific Image Upgrade**: Update container image to specific version (chart unchanged) |
| 24 | +2. **Chart Minor Version Upgrade**: Update chart to latest minor version (may include image updates) |
| 25 | + |
| 26 | +**IMPORTANT**: Container images are ONLY updated as part of chart upgrades, never independently (unless Type 1). |
| 27 | + |
| 28 | +## Process |
| 29 | + |
| 30 | +### 1. Identify Upgrade Type |
| 31 | + |
| 32 | +Ask the user which type of upgrade they want: |
| 33 | +- Type 1: Specific image version upgrade |
| 34 | +- Type 2: Latest minor chart version upgrade |
| 35 | + |
| 36 | +Also ask which chart: `postgresql` or `vault` |
| 37 | + |
| 38 | +### 2. Pre-Upgrade Validation |
| 39 | + |
| 40 | +Check current state: |
| 41 | +```bash |
| 42 | +cat deployment/chainloop/charts/<chart-name>/Chart.yaml | grep "^version:" |
| 43 | +cat deployment/chainloop/charts/<chart-name>/Chart.yaml | grep "^appVersion:" |
| 44 | +``` |
| 45 | + |
| 46 | +### 3. Version Compatibility Check |
| 47 | + |
| 48 | +For any version change, validate that major version remains the same: |
| 49 | +```bash |
| 50 | +CURRENT_MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1) |
| 51 | +TARGET_MAJOR=$(echo "$TARGET_VERSION" | cut -d. -f1) |
| 52 | + |
| 53 | +if [ "$CURRENT_MAJOR" != "$TARGET_MAJOR" ]; then |
| 54 | + echo "FORBIDDEN: Major version upgrade detected" |
| 55 | + exit 1 |
| 56 | +fi |
| 57 | +``` |
| 58 | + |
| 59 | +If major version upgrade detected, STOP and escalate. |
| 60 | + |
| 61 | +## Type 1: Specific Image Upgrade |
| 62 | + |
| 63 | +See [image-upgrade-process.md](image-upgrade-process.md) for detailed steps. |
| 64 | + |
| 65 | +**Summary**: |
| 66 | +1. Locate target container image in [Bitnami Containers](https://github.com/bitnami/containers) |
| 67 | +2. Find commit with release message pattern |
| 68 | +3. Extract APP_VERSION from Dockerfile |
| 69 | +4. Update `deployment/charts/<chart-name>/Chart.yaml` appVersion |
| 70 | +5. Update `.github/workflows/build_external_container_images.yaml` commit hash |
| 71 | + |
| 72 | +## Type 2: Chart Minor Version Upgrade |
| 73 | + |
| 74 | +See [chart-upgrade-process.md](chart-upgrade-process.md) for detailed steps. |
| 75 | + |
| 76 | +**Summary**: |
| 77 | +1. Locate target chart version in [Bitnami Charts](https://github.com/bitnami/charts) CHANGELOG.md |
| 78 | +2. Validate minor version upgrade only |
| 79 | +3. Download and extract target chart |
| 80 | +4. Check for image changes (compare Chart.yaml) |
| 81 | +5. If images changed, update container image references |
| 82 | +6. Vendorize chart update (copy files) |
| 83 | +7. Update dependencies in correct order |
| 84 | +8. Update main chart dependency version |
| 85 | +9. Clean up temporary files |
| 86 | + |
| 87 | +## Verification |
| 88 | + |
| 89 | +After any upgrade type, run: |
| 90 | +```bash |
| 91 | +# Lint charts |
| 92 | +helm lint deployment/charts/<chart-name> |
| 93 | +helm lint deployment/chainloop |
| 94 | + |
| 95 | +# Template validation |
| 96 | +helm template deployment/charts/<chart-name> |
| 97 | +helm template deployment/chainloop |
| 98 | + |
| 99 | +# Local testing |
| 100 | +cd devel && docker compose up |
| 101 | + |
| 102 | +# Verify image consistency |
| 103 | +grep -r "appVersion\|image.*tag" deployment/charts/<chart-name>/ |
| 104 | +``` |
| 105 | + |
| 106 | +## Files Modified |
| 107 | + |
| 108 | +See [files-modified.md](files-modified.md) for complete list. |
| 109 | + |
| 110 | +## Troubleshooting |
| 111 | + |
| 112 | +Common issues: |
| 113 | +- **Image Version Mismatch**: Verify APP_VERSION matches Chart.yaml appVersion |
| 114 | +- **Build Failures**: Check commit reference in build workflow |
| 115 | +- **Dependency Conflicts**: Verify dependencies updated in correct order (vendorized first, then main chart) |
| 116 | + |
| 117 | +## Rollback |
| 118 | + |
| 119 | +If issues occur: |
| 120 | +```bash |
| 121 | +git checkout HEAD -- deployment/ |
| 122 | +find deployment/ -name "Chart.lock" -delete |
| 123 | +cd deployment/chainloop && helm dependency build |
| 124 | +cd ../../devel && docker compose down && docker compose up |
| 125 | +``` |
| 126 | + |
| 127 | +## Important Notes |
| 128 | + |
| 129 | +- Dex is self-managed and follows a separate process (not covered by this skill) |
| 130 | +- Always use commit hashes for reproducibility |
| 131 | +- Dependencies must be updated in correct order: vendorized chart first, then main chart |
| 132 | +- Container images are found in Bitnami Containers repo, charts in Bitnami Charts repo |
0 commit comments