Skip to content

Debugging and Development Tips

Malini Das edited this page Oct 8, 2024 · 1 revision

GitHub Actions can be frustrating to debug. While the built-in logging features are nice, there are times when you want to debug a runner with more granularity.

When working with Github Actions Runners, you can create a Dockerfile and pre-install the packages you need to simulate your runner environment. The contents of the "ubuntu:latest" image used by GitHub Actions are documented here. You don't have to set all of that up, though.

An example from RyanJ: I know I need a working node env with this repo's code in it, so I'll throw together something like this as a Dockerfile:

FROM ubuntu:latest

RUN DEBIAN_FRONTEND=noninteractive \
    ```apt update -y \
    ```&& apt install -y jq npm \
    ```&& mkdir -p /opt/thunderbird/send-suite

ADD . /opt/thunderbird/send-suite

CMD /bin/bash

Then I can docker build that and docker run it and now I have a bash shell that's set up the same way the runners are. In the model of "GHA as Bash executors" this has been helpful, since most of the problems with debugging bash are syntax and weird error codes and working with package managers I don't have on my system. This has helped solve those problems for me while keeping development local and fast.

Clone this wiki locally