From fb10267d4c3deb056d4848114d0c114d8faad949 Mon Sep 17 00:00:00 2001 From: Rasmus Rask Date: Fri, 31 Jan 2025 08:59:27 +0100 Subject: [PATCH 1/2] Compact alerts by writing as one paragraph --- flux-helm-diff.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/flux-helm-diff.sh b/flux-helm-diff.sh index 06f90cf..13dbcf8 100755 --- a/flux-helm-diff.sh +++ b/flux-helm-diff.sh @@ -21,7 +21,6 @@ output_msg() { # Message line(s) for msg in "$@"; do echo "> ${msg}" - echo '>' done echo } >> "$GITHUB_OUTPUT" From 384d97c9ff911a555ced1ce491522e231b2c30ca Mon Sep 17 00:00:00 2001 From: Rasmus Rask Date: Mon, 3 Nov 2025 16:51:08 +0100 Subject: [PATCH 2/2] Only add capability notifications for `head`, remove line-break --- flux-helm-diff.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/flux-helm-diff.sh b/flux-helm-diff.sh index 13dbcf8..7d919b3 100755 --- a/flux-helm-diff.sh +++ b/flux-helm-diff.sh @@ -172,25 +172,27 @@ helm_template() { # Check if chart is using .Capabilities.KubeVersion grep -R --include='*.yaml' --include='*.yml' --include='*.tpl' ".Capabilities.KubeVersion" "${chart_temp_path}" > /dev/null && { echo "${ref} uses \".Capabilities.KubeVersion\"" >&2 - if [[ ${#kube_version} -eq 0 ]]; then - output_msg TIP "Chart in \`${ref}\` ref uses [\`.Capabilities.KubeVersion\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) but is not specifying a Kubernetes version to simulate. Will use Helm's default Kubernetes version: \`${helm_default_kube_version}\`." \ - "See [Simulating Capabilities](https://github.com/marketplace/actions/flux-helm-diff#simulating-capabilities) for details." - helm_kube_version=() # treat as array, to avoid adding single-quotes - else - output_msg TIP "Chart in \`${ref}\` ref uses [\`.Capabilities.KubeVersion\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) and is simulating the following Kubernetes version: \`${kube_version}\`" - helm_kube_version=(--kube-version "${kube_version}") # treat as array, to avoid adding single-quotes + if [[ "${ref}" == "head" ]]; then + if [[ ${#kube_version} -eq 0 ]]; then + output_msg TIP "Chart in \`${ref}\` ref uses [\`.Capabilities.KubeVersion\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) but is not specifying a Kubernetes version to simulate. Will use Helm's default Kubernetes version: \`${helm_default_kube_version}\`. See [Simulating Capabilities](https://github.com/marketplace/actions/flux-helm-diff#simulating-capabilities) for details." + helm_kube_version=() # treat as array, to avoid adding single-quotes + else + output_msg TIP "Chart in \`${ref}\` ref uses [\`.Capabilities.KubeVersion\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) and is simulating the following Kubernetes version: \`${kube_version}\`" + helm_kube_version=(--kube-version "${kube_version}") # treat as array, to avoid adding single-quotes + fi fi } # Check if chart is using .Capabilities.APIVersions grep -R --include='*.yaml' --include='*.yml' --include='*.tpl' ".Capabilities.APIVersions" "${chart_temp_path}" > /dev/null && { echo "${ref} uses \".Capabilities.APIVersions\"" >&2 - if [[ ${#api_versions[@]} -eq 0 ]]; then - output_msg IMPORTANT "Chart in \`${ref}\` ref uses [\`.Capabilities.APIVersions\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) but is not specifying any APIs to simulate. Only the built-in API versions are available for templating." \ - "See [Simulating Capabilities](https://github.com/marketplace/actions/flux-helm-diff#simulating-capabilities) for details." - else - output_msg TIP "Chart in \`${ref}\` ref uses [\`.Capabilities.APIVersions\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) and is simulating the following APIs, in addition to the built-in:" \ - "$(printf "\`%s\`\n" "${api_versions[@]}")" + if [[ "${ref}" == "head" ]]; then + if [[ ${#api_versions[@]} -eq 0 ]]; then + output_msg IMPORTANT "Chart in \`${ref}\` ref uses [\`.Capabilities.APIVersions\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) but is not specifying any APIs to simulate. Only the built-in API versions are available for templating. See [Simulating Capabilities](https://github.com/marketplace/actions/flux-helm-diff#simulating-capabilities) for details." + else + output_msg TIP "Chart in \`${ref}\` ref uses [\`.Capabilities.APIVersions\`](https://helm.sh/docs/chart_template_guide/builtin_objects/) and is simulating the following APIs, in addition to the built-in:" \ + "$(printf "\`%s\`\n" "${api_versions[@]}")" + fi fi }