# Tekton Task for Pipeline Summary
# This task generates a summary of the pipeline execution

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: pipeline-summary
  namespace: {{ .Release.Namespace }}
  labels:
    app.kubernetes.io/name: {{ .Values.labels.app.name }}
    app.kubernetes.io/component: summary
spec:
  params:
    - name: changed-services
      type: string
      description: Services that were changed
    - name: git-revision
      type: string
      description: Git revision being processed
  steps:
    - name: generate-summary
      image: alpine:3.19
      securityContext:
        runAsNonRoot: true
        runAsUser: 65532
        allowPrivilegeEscalation: false
        capabilities:
          drop:
            - ALL
        seccompProfile:
          type: RuntimeDefault
      script: |
        #!/bin/sh
        set -e
        
        echo "=== Bakery-IA CI Pipeline Summary ==="
        echo "Git Revision: $(params.git-revision)"
        echo "Changed Services: $(params.changed-services)"
        echo "Pipeline completed successfully"
        
        # Log summary to stdout for visibility
        echo "Summary generated"