Commit da835c0
fix(ci): tighten publish_chart phase against silent half-success
Three issues from a second pass over the new opt-in chart publish:
1. Each gated step had `if: steps.bump.outputs.changed == 'true'`
without `success()`. In GitHub Actions an explicit `if:` REPLACES
the default `success()` check, so a failed `git push` (e.g. branch
moved during the run) would still let the subsequent helm push run
— leaving the OCI chart pushed but the source-of-truth commit not
in git. Prepend `success() &&` to every gated step.
2. Version parsing `IFS=. read -r MAJ MIN PATCH` blindly trusted
`X.Y.Z` shape. A version like `1.5.6-rc1` parsed PATCH as `6-rc1`
and `$((PATCH+1))` would crash mid-bump after sed had already
modified files. Validate `OLD_VERSION` matches `^[0-9]+\.[0-9]+\.[0-9]+$`
before mutating anything, and exit with a clear message pointing
to BUILD.md step 5 for manual bumps.
3. appVersion parsing assumes double-quoted value (current Chart.yaml
convention). If a future edit drops the quotes, the sed fallback
silently captures the entire line and the global `sed -i` would
mangle every file. Validate `OLD_HASH` matches `^[a-f0-9]{7,40}$`
before proceeding.
Also drop `inputs.publish_chart == true` for the cleaner
`inputs.publish_chart` (the input is `type: boolean`, so the
comparison was redundant).
Edge cases verified: happy path, same-hash skip, pre-release
suffix rejected, build-meta suffix rejected, non-hex appVersion
rejected, 7-char hash accepted, uppercase hash rejected, double-
digit patch (1.5.99 -> 1.5.100).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent de2dc35 commit da835c0
1 file changed
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
816 | | - | |
| 816 | + | |
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
841 | 851 | | |
842 | 852 | | |
843 | 853 | | |
844 | 854 | | |
845 | 855 | | |
846 | 856 | | |
847 | | - | |
848 | 857 | | |
849 | 858 | | |
850 | 859 | | |
| |||
866 | 875 | | |
867 | 876 | | |
868 | 877 | | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
869 | 881 | | |
870 | | - | |
| 882 | + | |
871 | 883 | | |
872 | 884 | | |
873 | 885 | | |
| |||
880 | 892 | | |
881 | 893 | | |
882 | 894 | | |
883 | | - | |
| 895 | + | |
884 | 896 | | |
885 | 897 | | |
886 | 898 | | |
887 | | - | |
| 899 | + | |
888 | 900 | | |
889 | 901 | | |
890 | 902 | | |
| |||
893 | 905 | | |
894 | 906 | | |
895 | 907 | | |
896 | | - | |
| 908 | + | |
897 | 909 | | |
898 | 910 | | |
899 | 911 | | |
| |||
0 commit comments