From c306e1db1af765fade2e90a9c2ee0833e69b4acf Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Wed, 29 Apr 2026 18:36:38 +0200 Subject: [PATCH] externalize summary --- .gitea/actions/ci-summary/action.yaml | 41 ++++++++++++++++ .gitea/actions/deployment-summary/action.yaml | 41 ++++++++++++++++ .../action.yaml | 19 ------- .../action.yaml | 19 ------- .gitea/workflows/{cd.yaml => deploy.yaml} | 49 ++++++++++++------- .gitea/workflows/{ci.yaml => validate.yaml} | 49 ++++++++++++------- 6 files changed, 144 insertions(+), 74 deletions(-) create mode 100644 .gitea/actions/ci-summary/action.yaml create mode 100644 .gitea/actions/deployment-summary/action.yaml delete mode 100644 .gitea/actions/extract-chart-name-from-repo-name/action.yaml delete mode 100644 .gitea/actions/extract-namespace-from-repo-name/action.yaml rename .gitea/workflows/{cd.yaml => deploy.yaml} (76%) rename .gitea/workflows/{ci.yaml => validate.yaml} (71%) diff --git a/.gitea/actions/ci-summary/action.yaml b/.gitea/actions/ci-summary/action.yaml new file mode 100644 index 0000000..c9a71fc --- /dev/null +++ b/.gitea/actions/ci-summary/action.yaml @@ -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" diff --git a/.gitea/actions/deployment-summary/action.yaml b/.gitea/actions/deployment-summary/action.yaml new file mode 100644 index 0000000..00647f3 --- /dev/null +++ b/.gitea/actions/deployment-summary/action.yaml @@ -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" diff --git a/.gitea/actions/extract-chart-name-from-repo-name/action.yaml b/.gitea/actions/extract-chart-name-from-repo-name/action.yaml deleted file mode 100644 index 7e72d80..0000000 --- a/.gitea/actions/extract-chart-name-from-repo-name/action.yaml +++ /dev/null @@ -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- -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 diff --git a/.gitea/actions/extract-namespace-from-repo-name/action.yaml b/.gitea/actions/extract-namespace-from-repo-name/action.yaml deleted file mode 100644 index d8a639e..0000000 --- a/.gitea/actions/extract-namespace-from-repo-name/action.yaml +++ /dev/null @@ -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_" -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 diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/deploy.yaml similarity index 76% rename from .gitea/workflows/cd.yaml rename to .gitea/workflows/deploy.yaml index fb4518c..becfeff 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/deploy.yaml @@ -28,6 +28,19 @@ on: required: false default: "{}" 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: detect-service-type: @@ -126,30 +139,30 @@ jobs: helmfile-args: apply env: ${{ fromJSON(inputs.helmfile_env) }} - # Summary job that always runs to show what was deployed - deployment-summary: + summary-data: runs-on: ubuntu-latest needs: [detect-service-type, deploy-k8s, deploy-helm] 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: - - name: Deployment Summary + - name: Export summary data + id: export run: | - echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY + has_k8s="${{ needs.detect-service-type.outputs.has_k8s }}" + 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 - echo "✅ **Kubernetes deployment**: Completed" >> $GITHUB_STEP_SUMMARY + if [ "$has_helmfile" = "true" ]; then + service_type="Helm + Kubernetes" else - echo "❌ **Kubernetes deployment**: Skipped (no k8s/ directory found)" >> $GITHUB_STEP_SUMMARY + service_type="Kubernetes Only" fi - if [ "${{ needs.detect-service-type.outputs.has_helmfile }}" == "true" ] && [ "${{ inputs.skip_helm_deployment }}" != "true" ]; then - echo "✅ **Helm deployment**: Completed" >> $GITHUB_STEP_SUMMARY - elif [ "${{ needs.detect-service-type.outputs.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 - echo "**Service Type**: ${{ needs.detect-service-type.outputs.has_helmfile == 'true' && 'Helm + Kubernetes' || 'Kubernetes Only' }}" >> $GITHUB_STEP_SUMMARY + echo "has_k8s=$has_k8s" >> "$GITHUB_OUTPUT" + echo "has_helmfile=$has_helmfile" >> "$GITHUB_OUTPUT" + echo "skip_helm_deployment=$skip_helm_deployment" >> "$GITHUB_OUTPUT" + echo "service_type=$service_type" >> "$GITHUB_OUTPUT" diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/validate.yaml similarity index 71% rename from .gitea/workflows/ci.yaml rename to .gitea/workflows/validate.yaml index c9316e2..e36f680 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/validate.yaml @@ -23,6 +23,19 @@ on: required: false default: "{}" 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: detect-service-type: @@ -100,30 +113,30 @@ jobs: helmfile-args: diff env: ${{ fromJSON(inputs.helmfile_env) }} - # Summary job that always runs to show what was validated - ci-summary: + summary-data: runs-on: ubuntu-latest needs: [detect-service-type, validate-k8s, validate-helm] 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: - - name: CI Summary + - name: Export summary data + id: export run: | - echo "## CI Validation Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY + has_k8s="${{ needs.detect-service-type.outputs.has_k8s }}" + 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 - echo "✅ **Kubernetes validation**: Completed" >> $GITHUB_STEP_SUMMARY + if [ "$has_helmfile" = "true" ]; then + service_type="Helm + Kubernetes" else - echo "❌ **Kubernetes validation**: Skipped (no k8s/ directory found)" >> $GITHUB_STEP_SUMMARY + service_type="Kubernetes Only" fi - if [ "${{ needs.detect-service-type.outputs.has_helmfile }}" == "true" ] && [ "${{ inputs.skip_helm_validation }}" != "true" ]; then - echo "✅ **Helm validation**: Completed" >> $GITHUB_STEP_SUMMARY - elif [ "${{ needs.detect-service-type.outputs.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 - echo "**Service Type**: ${{ needs.detect-service-type.outputs.has_helmfile == 'true' && 'Helm + Kubernetes' || 'Kubernetes Only' }}" >> $GITHUB_STEP_SUMMARY + echo "has_k8s=$has_k8s" >> "$GITHUB_OUTPUT" + echo "has_helmfile=$has_helmfile" >> "$GITHUB_OUTPUT" + echo "skip_helm_validation=$skip_helm_validation" >> "$GITHUB_OUTPUT" + echo "service_type=$service_type" >> "$GITHUB_OUTPUT"