externalize summary

This commit is contained in:
2026-04-29 18:36:38 +02:00
parent c40148a3e1
commit c306e1db1a
6 changed files with 144 additions and 74 deletions
+41
View File
@@ -0,0 +1,41 @@
name: "CI Summary"
description: "Writes CI validation summary to GITHUB_STEP_SUMMARY"
inputs:
has_k8s:
description: "Whether Kubernetes manifests were detected"
required: true
has_helmfile:
description: "Whether helmfile.yaml was detected"
required: true
skip_helm_validation:
description: "Whether Helm validation is manually disabled"
required: true
runs:
using: "composite"
steps:
- shell: bash
run: |
echo "## CI Validation Summary" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
if [ "${{ inputs.has_k8s }}" = "true" ]; then
echo "✅ **Kubernetes validation**: Completed" >> "$GITHUB_STEP_SUMMARY"
else
echo "❌ **Kubernetes validation**: Skipped (no k8s/ directory found)" >> "$GITHUB_STEP_SUMMARY"
fi
if [ "${{ inputs.has_helmfile }}" = "true" ] && [ "${{ inputs.skip_helm_validation }}" != "true" ]; then
echo "✅ **Helm validation**: Completed" >> "$GITHUB_STEP_SUMMARY"
elif [ "${{ inputs.has_helmfile }}" = "true" ] && [ "${{ inputs.skip_helm_validation }}" = "true" ]; then
echo "⏭️ **Helm validation**: Skipped (manually disabled)" >> "$GITHUB_STEP_SUMMARY"
else
echo "⏭️ **Helm validation**: Skipped (no helmfile.yaml found)" >> "$GITHUB_STEP_SUMMARY"
fi
echo "" >> "$GITHUB_STEP_SUMMARY"
if [ "${{ inputs.has_helmfile }}" = "true" ]; then
service_type="Helm + Kubernetes"
else
service_type="Kubernetes Only"
fi
echo "**Service Type**: ${service_type}" >> "$GITHUB_STEP_SUMMARY"
@@ -0,0 +1,41 @@
name: "Deployment Summary"
description: "Writes deployment summary to GITHUB_STEP_SUMMARY"
inputs:
has_k8s:
description: "Whether Kubernetes manifests were detected"
required: true
has_helmfile:
description: "Whether helmfile.yaml was detected"
required: true
skip_helm_deployment:
description: "Whether Helm deployment is manually disabled"
required: true
runs:
using: "composite"
steps:
- shell: bash
run: |
echo "## Deployment Summary" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
if [ "${{ inputs.has_k8s }}" = "true" ]; then
echo "✅ **Kubernetes deployment**: Completed" >> "$GITHUB_STEP_SUMMARY"
else
echo "❌ **Kubernetes deployment**: Skipped (no k8s/ directory found)" >> "$GITHUB_STEP_SUMMARY"
fi
if [ "${{ inputs.has_helmfile }}" = "true" ] && [ "${{ inputs.skip_helm_deployment }}" != "true" ]; then
echo "✅ **Helm deployment**: Completed" >> "$GITHUB_STEP_SUMMARY"
elif [ "${{ inputs.has_helmfile }}" = "true" ] && [ "${{ inputs.skip_helm_deployment }}" = "true" ]; then
echo "⏭️ **Helm deployment**: Skipped (manually disabled)" >> "$GITHUB_STEP_SUMMARY"
else
echo "⏭️ **Helm deployment**: Skipped (no helmfile.yaml found)" >> "$GITHUB_STEP_SUMMARY"
fi
echo "" >> "$GITHUB_STEP_SUMMARY"
if [ "${{ inputs.has_helmfile }}" = "true" ]; then
service_type="Helm + Kubernetes"
else
service_type="Kubernetes Only"
fi
echo "**Service Type**: ${service_type}" >> "$GITHUB_STEP_SUMMARY"
@@ -1,19 +0,0 @@
name: Extract chart name from repo name
description: Extracts the chart name from the repo name, based on the convention of helm-<chart-name>
inputs:
repo:
description: The full repository name (e.g., "helm-my-chart")
required: true
outputs:
chart-name:
description: The extracted chart name
value: ${{ steps.extract.outputs.suffix }}
runs:
using: "composite"
steps:
- id: extract
shell: bash
run: |
full_repo="${{ inputs.repo }}"
suffix="${full_repo##*helm-}"
echo "suffix=$suffix" >> $GITHUB_OUTPUT
@@ -1,19 +0,0 @@
name: "Extract namespace from repo name"
description: "Extracts the namespace name from the repo name, based on the convention of k_<namespace-name>"
inputs:
repo:
description: 'The repo name, get it from "github.repository"'
required: true
outputs:
namespace:
description: "The namespace name"
value: ${{ steps.extract.outputs.suffix }}
runs:
using: "composite"
steps:
- id: extract
shell: bash
run: |
full_repo="${{ inputs.repo }}"
suffix="${full_repo##*k_}"
echo "suffix=$suffix" >> $GITHUB_OUTPUT
@@ -28,6 +28,19 @@ on:
required: false required: false
default: "{}" default: "{}"
type: string type: string
outputs:
has_k8s:
description: "Whether Kubernetes manifests were detected"
value: ${{ jobs.summary-data.outputs.has_k8s }}
has_helmfile:
description: "Whether helmfile.yaml was detected"
value: ${{ jobs.summary-data.outputs.has_helmfile }}
skip_helm_deployment:
description: "Whether Helm deployment was manually skipped"
value: ${{ jobs.summary-data.outputs.skip_helm_deployment }}
service_type:
description: "Service type inferred from repository contents"
value: ${{ jobs.summary-data.outputs.service_type }}
jobs: jobs:
detect-service-type: detect-service-type:
@@ -126,30 +139,30 @@ jobs:
helmfile-args: apply helmfile-args: apply
env: ${{ fromJSON(inputs.helmfile_env) }} env: ${{ fromJSON(inputs.helmfile_env) }}
# Summary job that always runs to show what was deployed summary-data:
deployment-summary:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [detect-service-type, deploy-k8s, deploy-helm] needs: [detect-service-type, deploy-k8s, deploy-helm]
if: always() if: always()
outputs:
has_k8s: ${{ steps.export.outputs.has_k8s }}
has_helmfile: ${{ steps.export.outputs.has_helmfile }}
skip_helm_deployment: ${{ steps.export.outputs.skip_helm_deployment }}
service_type: ${{ steps.export.outputs.service_type }}
steps: steps:
- name: Deployment Summary - name: Export summary data
id: export
run: | run: |
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY has_k8s="${{ needs.detect-service-type.outputs.has_k8s }}"
echo "" >> $GITHUB_STEP_SUMMARY has_helmfile="${{ needs.detect-service-type.outputs.has_helmfile }}"
skip_helm_deployment="${{ inputs.skip_helm_deployment }}"
if [ "${{ needs.detect-service-type.outputs.has_k8s }}" == "true" ]; then if [ "$has_helmfile" = "true" ]; then
echo "✅ **Kubernetes deployment**: Completed" >> $GITHUB_STEP_SUMMARY service_type="Helm + Kubernetes"
else else
echo "❌ **Kubernetes deployment**: Skipped (no k8s/ directory found)" >> $GITHUB_STEP_SUMMARY service_type="Kubernetes Only"
fi fi
if [ "${{ needs.detect-service-type.outputs.has_helmfile }}" == "true" ] && [ "${{ inputs.skip_helm_deployment }}" != "true" ]; then echo "has_k8s=$has_k8s" >> "$GITHUB_OUTPUT"
echo "✅ **Helm deployment**: Completed" >> $GITHUB_STEP_SUMMARY echo "has_helmfile=$has_helmfile" >> "$GITHUB_OUTPUT"
elif [ "${{ needs.detect-service-type.outputs.has_helmfile }}" == "true" ] && [ "${{ inputs.skip_helm_deployment }}" == "true" ]; then echo "skip_helm_deployment=$skip_helm_deployment" >> "$GITHUB_OUTPUT"
echo "⏭️ **Helm deployment**: Skipped (manually disabled)" >> $GITHUB_STEP_SUMMARY echo "service_type=$service_type" >> "$GITHUB_OUTPUT"
else
echo "⏭️ **Helm deployment**: Skipped (no helmfile.yaml found)" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Service Type**: ${{ needs.detect-service-type.outputs.has_helmfile == 'true' && 'Helm + Kubernetes' || 'Kubernetes Only' }}" >> $GITHUB_STEP_SUMMARY
@@ -23,6 +23,19 @@ on:
required: false required: false
default: "{}" default: "{}"
type: string type: string
outputs:
has_k8s:
description: "Whether Kubernetes manifests were detected"
value: ${{ jobs.summary-data.outputs.has_k8s }}
has_helmfile:
description: "Whether helmfile.yaml was detected"
value: ${{ jobs.summary-data.outputs.has_helmfile }}
skip_helm_validation:
description: "Whether Helm validation was manually skipped"
value: ${{ jobs.summary-data.outputs.skip_helm_validation }}
service_type:
description: "Service type inferred from repository contents"
value: ${{ jobs.summary-data.outputs.service_type }}
jobs: jobs:
detect-service-type: detect-service-type:
@@ -100,30 +113,30 @@ jobs:
helmfile-args: diff helmfile-args: diff
env: ${{ fromJSON(inputs.helmfile_env) }} env: ${{ fromJSON(inputs.helmfile_env) }}
# Summary job that always runs to show what was validated summary-data:
ci-summary:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [detect-service-type, validate-k8s, validate-helm] needs: [detect-service-type, validate-k8s, validate-helm]
if: always() if: always()
outputs:
has_k8s: ${{ steps.export.outputs.has_k8s }}
has_helmfile: ${{ steps.export.outputs.has_helmfile }}
skip_helm_validation: ${{ steps.export.outputs.skip_helm_validation }}
service_type: ${{ steps.export.outputs.service_type }}
steps: steps:
- name: CI Summary - name: Export summary data
id: export
run: | run: |
echo "## CI Validation Summary" >> $GITHUB_STEP_SUMMARY has_k8s="${{ needs.detect-service-type.outputs.has_k8s }}"
echo "" >> $GITHUB_STEP_SUMMARY has_helmfile="${{ needs.detect-service-type.outputs.has_helmfile }}"
skip_helm_validation="${{ inputs.skip_helm_validation }}"
if [ "${{ needs.detect-service-type.outputs.has_k8s }}" == "true" ]; then if [ "$has_helmfile" = "true" ]; then
echo "✅ **Kubernetes validation**: Completed" >> $GITHUB_STEP_SUMMARY service_type="Helm + Kubernetes"
else else
echo "❌ **Kubernetes validation**: Skipped (no k8s/ directory found)" >> $GITHUB_STEP_SUMMARY service_type="Kubernetes Only"
fi fi
if [ "${{ needs.detect-service-type.outputs.has_helmfile }}" == "true" ] && [ "${{ inputs.skip_helm_validation }}" != "true" ]; then echo "has_k8s=$has_k8s" >> "$GITHUB_OUTPUT"
echo "✅ **Helm validation**: Completed" >> $GITHUB_STEP_SUMMARY echo "has_helmfile=$has_helmfile" >> "$GITHUB_OUTPUT"
elif [ "${{ needs.detect-service-type.outputs.has_helmfile }}" == "true" ] && [ "${{ inputs.skip_helm_validation }}" == "true" ]; then echo "skip_helm_validation=$skip_helm_validation" >> "$GITHUB_OUTPUT"
echo "⏭️ **Helm validation**: Skipped (manually disabled)" >> $GITHUB_STEP_SUMMARY echo "service_type=$service_type" >> "$GITHUB_OUTPUT"
else
echo "⏭️ **Helm validation**: Skipped (no helmfile.yaml found)" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Service Type**: ${{ needs.detect-service-type.outputs.has_helmfile == 'true' && 'Helm + Kubernetes' || 'Kubernetes Only' }}" >> $GITHUB_STEP_SUMMARY