View Kubernetes Logs in PRs
Here's an example of a Stoat comment that links to an interactive log viewer for Kubernetes:
See a real build that links to a log viewer for Kubernetes logs this pull request.
Adding Kubernetes log previews to the Stoat comment
In this tutorial we will show how to add a Kubernetes log preview to the Stoat comment.
Set up Stoat with our getting started guide.
Add an action to dump logs to some directory using
stoat-dev/kubernetes-log-export-action@v1and add the Stoat Action to upload the log outputs to Stoat..github/workflows/kubernetes.yaml
# ... cluster initialization ...
# ... tests that run on Kubernetes ...
- name: Dump Kubernetes Logs
- name: Run Stoat Action
Note that if you don't include
if: always()the results will not be captured on test failure.
Point Stoat at the generated logs by adding a new task that uses the
name: "Kubernetes Logs"
Note that this uses the
file_viewer: trueoption to provide an interactive log viewing experience.
That's it! Now, every time you open a pull request, Stoat will host the Kubernetes logs and post a comment with a link to the preview. See an example in this pull request.