|
| 1 | +name: Chart.lock Validation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: |
| 6 | + - edited |
| 7 | + - opened |
| 8 | + - reopened |
| 9 | + - synchronized |
| 10 | + |
| 11 | +jobs: |
| 12 | + validate-chart-lock: |
| 13 | + name: Validate Chart.lock |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Check Chart.lock for 0.0.0-dev entries |
| 22 | + id: check |
| 23 | + run: | |
| 24 | + echo "🔍 Checking Chart.lock for 0.0.0-dev entries..." |
| 25 | + |
| 26 | + if [ ! -f Chart.lock ]; then |
| 27 | + echo "ℹ️ No Chart.lock file found" |
| 28 | + echo "has_dev_version=false" >> $GITHUB_OUTPUT |
| 29 | + exit 0 |
| 30 | + fi |
| 31 | + |
| 32 | + # Check if Chart.lock contains 0.0.0-dev version |
| 33 | + if grep -q "version: 0.0.0-dev" Chart.lock; then |
| 34 | + echo "❌ Found 0.0.0-dev in Chart.lock" |
| 35 | + echo "has_dev_version=true" >> $GITHUB_OUTPUT |
| 36 | + |
| 37 | + echo "" |
| 38 | + echo "Problematic entries:" |
| 39 | + grep -B2 -A2 "version: 0.0.0-dev" Chart.lock || true |
| 40 | + |
| 41 | + echo "" |
| 42 | + echo "::error::Chart.lock contains 0.0.0-dev entries that must be removed" |
| 43 | + |
| 44 | + else |
| 45 | + echo "✅ No 0.0.0-dev entries found in Chart.lock" |
| 46 | + echo "has_dev_version=false" >> $GITHUB_OUTPUT |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Add comment to PR |
| 50 | + if: steps.check.outputs.has_dev_version == 'true' |
| 51 | + run: | |
| 52 | + gh pr comment ${{ github.event.pull_request.number }} --body "## ❌ Chart.lock Contains 0.0.0-dev Entries |
| 53 | +
|
| 54 | + Found \`0.0.0-dev\` entries in \`Chart.lock\` that must be removed. |
| 55 | +
|
| 56 | + **Why this is a problem:** |
| 57 | + The \`kata-as-coco-runtime-for-ci\` dependency uses \`version: 0.0.0-dev\` which is: |
| 58 | + - Only for CI testing |
| 59 | + - Not a real release |
| 60 | + - Should never be committed to Chart.lock |
| 61 | +
|
| 62 | + **How to fix:** |
| 63 | +
|
| 64 | + Manually edit Chart.lock to remove the entire dependency block containing \`version: 0.0.0-dev\`: |
| 65 | +
|
| 66 | + \`\`\`yaml |
| 67 | + # Remove this entire block from Chart.lock: |
| 68 | + - name: kata-deploy |
| 69 | + repository: oci://ghcr.io/kata-containers/kata-deploy-charts |
| 70 | + version: 0.0.0-dev |
| 71 | + \`\`\` |
| 72 | +
|
| 73 | + Then commit and push: |
| 74 | + \`\`\`bash |
| 75 | + git add Chart.lock |
| 76 | + git commit -m \"fix: Remove 0.0.0-dev from Chart.lock\" |
| 77 | + git push |
| 78 | + \`\`\` |
| 79 | +
|
| 80 | + **Why not regenerate with helm dependency update?** |
| 81 | + Running \`helm dependency update\` would add the 0.0.0-dev entry back. This entry only exists for CI testing and should never be in Chart.lock. |
| 82 | +
|
| 83 | + **Prevention:** |
| 84 | + Chart.lock is managed by CI/CD workflows. Don't manually run \`helm dependency update\` - the prepare-release script handles updates correctly." |
| 85 | + env: |
| 86 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + |
| 88 | + - name: Fail if 0.0.0-dev found |
| 89 | + if: steps.check.outputs.has_dev_version == 'true' |
| 90 | + run: | |
| 91 | + echo "::error::Chart.lock contains 0.0.0-dev entries that must be removed" |
| 92 | + exit 1 |
| 93 | +
|
| 94 | + - name: Summary |
| 95 | + if: always() |
| 96 | + run: | |
| 97 | + if [ "${{ steps.check.outputs.has_dev_version }}" = "true" ]; then |
| 98 | + cat >> $GITHUB_STEP_SUMMARY << 'EOF' |
| 99 | + ## ❌ Chart.lock Validation Failed |
| 100 | + |
| 101 | + Found `0.0.0-dev` entries in Chart.lock that must be removed. |
| 102 | + |
| 103 | + ### Why this is a problem |
| 104 | + |
| 105 | + The `kata-as-coco-runtime-for-ci` dependency uses `version: 0.0.0-dev` which is: |
| 106 | + - Only used for CI testing |
| 107 | + - Not a real release |
| 108 | + - Should never be committed to Chart.lock |
| 109 | + |
| 110 | + ### How to fix |
| 111 | + |
| 112 | + Manually edit Chart.lock to remove the entire dependency block containing `version: 0.0.0-dev`: |
| 113 | + |
| 114 | + ```yaml |
| 115 | + # Remove this entire block: |
| 116 | + - name: kata-deploy |
| 117 | + repository: oci://ghcr.io/kata-containers/kata-deploy-charts |
| 118 | + version: 0.0.0-dev |
| 119 | + ``` |
| 120 | + |
| 121 | + Then commit: |
| 122 | + ```bash |
| 123 | + git add Chart.lock |
| 124 | + git commit -m "fix: Remove 0.0.0-dev from Chart.lock" |
| 125 | + git push |
| 126 | + ``` |
| 127 | + |
| 128 | + ### Why not regenerate? |
| 129 | + |
| 130 | + **Don't run `helm dependency update`** - it will add 0.0.0-dev back. |
| 131 | + This entry only exists for CI testing. |
| 132 | + |
| 133 | + ### Prevention |
| 134 | + |
| 135 | + - Chart.lock is managed by CI/CD workflows |
| 136 | + - The prepare-release script handles updates correctly |
| 137 | + - Don't manually run `helm dependency update` |
| 138 | + EOF |
| 139 | + else |
| 140 | + echo "## ✅ Chart.lock Validated" >> $GITHUB_STEP_SUMMARY |
| 141 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 142 | + echo "No \`0.0.0-dev\` entries found in Chart.lock." >> $GITHUB_STEP_SUMMARY |
| 143 | + fi |
| 144 | +
|
0 commit comments