Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions validate-helm-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ process_chart() {
fi
fi

# Run template validation
# Run template validation: render the chart and validate the
# resulting manifests with kubeconform. The pipeline's exit status
# reflects kubeconform (the last command), which is what we check.
Comment on lines +120 to +121

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new comment says pipeline status reflects only kubeconform, but with set -o pipefail failures in helm template also fail the pipeline; this comment describes impossible behavior for this script.

Suggested change
# resulting manifests with kubeconform. The pipeline's exit status
# reflects kubeconform (the last command), which is what we check.
# resulting manifests with kubeconform. With pipefail enabled, the
# pipeline fails if either helm template or kubeconform fails.
Details

✨ AI Reasoning
​The updated explanatory comment asserts that the pipeline status comes from the final stage only. That assumption cannot hold in this script because pipeline failure behavior is globally altered to fail when any stage fails. This creates a clear contradiction between documented logic and actual execution behavior, which can mislead future changes and debugging.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

cd "$chart_absolute_path"
if ! helm template . 2>/dev/null | kubeconform --ignore-missing-schemas --summary --skip "$CUSTOM_RESOURCES" > "$result_file.template" 2>&1; then
if ! helm template . 2>/dev/null \
| kubeconform --ignore-missing-schemas --summary --skip "$CUSTOM_RESOURCES" \
> "$result_file.template" 2>&1; then
echo -e "${RED}✗ Kubeconform failed for ${chart_name}${NC}" >&2
cat "$result_file.template" >&2
has_error=1
Expand Down
Loading