canonical / observability

Apache License 2.0
7 stars 11 forks source link

Dump logs on itest failure #45

Closed sed-i closed 1 year ago

sed-i commented 1 year ago

Inspired by kubeflow, shall we add a log dump to the itests workflow?

    - name: Dump deployments
      if: failure()
      run: kubectl describe deployments -A
    - name: Dump replicasets
      if: failure()
      run: kubectl describe replicasets -A
    - name: Dump pods and their logs
      if: failure()
      shell: bash
      run: |
        juju status --relations --storage
        kubectl get pods -A -o=jsonpath='{range.items[*]}{.metadata.namespace} {.metadata.name}{"\n"}' --sort-by=.metadata.namespace | while read namespace pod; do kubectl -n $namespace describe pod $pod; kubectl -n $namespace logs $pod --all-containers=true --tail=100; done

cc: @lucabello @ca-scribner

sed-i commented 1 year ago

it might also on those jobs a good idea to use the upload-artifact action to upload:

/home/runner/.local/state/charmcraft/log/*.log

Originally posted by @addyess in https://github.com/charmed-kubernetes/pytest-operator/issues/106#issuecomment-1476614039