usimd / pi-gen-action

Action to build Raspberry Pi images using official pi-gen tool
MIT License
44 stars 9 forks source link

Verbose pi-gen stage logs? #43

Closed jedahan closed 1 year ago

jedahan commented 1 year ago

Is your feature request related to a problem? Please describe. I am trying to figure out why my build is failing, and debug logs only show Begin and End, but not what happens in between

Describe the solution you'd like When enabling debug logging with the github action, it would be nice to see each command that is being run, especially what fails

Describe alternatives you've considered Trying to run locally, but its difficult on macOS. Maybe there is a way to download verbose logs?

Additional context Add any other context or screenshots about the feature request here.

usimd commented 1 year ago

Could you clarify a little on what you'd expect? Especially what you mean by "each command that is being run".

The action itself just invokes the pi-gen Docker build, there is no fine grained control over what pi-gen does in the background. Currently, the action only reads the piped output from pi-gen and creates Action annotations according to where the message was written to (i.e. stdout or stderr).

The action recognizes a failure condition if the Docker execution returns unsuccessfully and will print the last stderr line as the associated failure.

To my knowledge, there are no additional debug logs in pi-gen. As long as they are not created, there is nothing we can handle in the action.

The only idea coming to my mind is to instruct the shell within the container to set -o xtrace. This would have to be added in the pi-gen execution. If you want to give this a shot, a PR is highly welcome.

usimd commented 1 year ago

Quick follow-up...

I dug into the Docker build of pi-gen a bit and found that invoking the script with -x would not be enough. The way to go for activating xtrace is to actually configure SHELLOPTS in PI_GEN_DOCKER_OPTS. Working example is at https://github.com/usimd/pi-gen-action/tree/pi-gen-xtrace.

This is a less than ideal solution, since absolutely all shell commands during the build will be added as debug logs and this can and will be crazy much.

jedahan commented 1 year ago

thanks for the investigation - I think the SHELLOPTS solution would have caught the issue I was having, which ended up being that a script was waiting on user input.