Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout running in Github actions / local Docker with user argument #5

Open
thejpster opened this issue Dec 21, 2019 · 3 comments
Open

Comments

@thejpster
Copy link

I found that if I tried to run this in a Github action, it fails with:

/usr/bin/docker run --name productizekicadautomationscripts_49ea2b --label af96b4 --workdir /github/workspace --rm -e INPUT_ENTRYPOINT -e INPUT_ARGS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true --entrypoint "python" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/Neotron-32-Hardware/Neotron-32-Hardware":"/github/workspace" productize/kicad-automation-scripts -m kicad-automation.eeschema.schematic run_erc /github/workspace/neotron-32.sch /github/workspace/erc
Initial recording window is set to:
X:0   Y:0    Width:800    Height:600
Adjusted recording window is set to:
X:0   Y:4    Width:800    Height:592
Your window manager appears to be Unknown

Initializing...
Output file: /github/workspace/erc/run_erc_schematic_screencast.ogv
Capturing!
INFO:util.ui_automation:Waiting for Project Rescue Helper window...

(eeschema:12): GLib-GObject-WARNING **: 23:58:22.530: invalid cast from 'GtkFileChooserButton' to 'GtkBin'

(eeschema:12): Gtk-CRITICAL **: 23:58:22.530: IA__gtk_bin_get_child: assertion 'GTK_IS_BIN (bin)' failed

(eeschema:12): Gtk-CRITICAL **: 23:58:22.530: IA__gtk_widget_set_sensitive: assertion 'GTK_IS_WIDGET (widget)' failed
INFO:__main__:Focus main eeschema window
INFO:util.ui_automation:Waiting for eeschema window...

See https://github.com/Neotron-Compute/Neotron-32-Hardware/commit/6eb0311dab4a15e725fa6943566218a5896dd1e6/checks?check_suite_id=359554627.

It works fine on my Ubuntu 19.10 machine locally using the same Docker container, but I was frustrated that the output files were owned by root. When I added --user $(id -u):$(id -g) to my Docker command line to try and fix this, I got the same error that Github Actions reports above:

$ docker run --rm -it -v /home/X/Documents/programming/neotron-compute/Neotron-32-Hardware:/kicad-project --user $(id -u):$(id -g) productize/kicad-automation-scripts  python -m kicad-automation.eeschema.schematic run_erc /kicad-project/neotron-32.sch /kicad-project/build

Initial recording window is set to:
X:0   Y:0    Width:800    Height:600
Adjusted recording window is set to:
X:0   Y:4    Width:800    Height:592
Your window manager appears to be Unknown

Initializing...
Output file: /kicad-project/build/run_erc_schematic_screencast-2.ogv
Capturing!
INFO:util.ui_automation:Waiting for Project Rescue Helper window...
INFO:__main__:Focus main eeschema window
INFO:util.ui_automation:Waiting for eeschema window...
   tting down....
Done.
Written 3126 bytes
(3126 of which were video data and 0 audio data)

..
Goodbye!
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/kicad-automation/eeschema/schematic.py", line 311, in <module>
    errors = eeschema_run_erc(schematic, output_dir, args.warnings_as_errors, args.junit_xml)
  File "/usr/lib/python2.7/dist-packages/kicad-automation/eeschema/schematic.py", line 227, in eeschema_run_erc
    wait_for_window('eeschema', '\[')
  File "/usr/lib/python2.7/dist-packages/kicad-automation/util/ui_automation.py", line 99, in wait_for_window
    raise RuntimeError('Timed out waiting for %s window' % name)
RuntimeError: Timed out waiting for eeschema window
@set-soft
Copy link

set-soft commented May 7, 2020

Here is a project showing a working GitHub action (and a fork of this project):
https://github.com/INTI-CMNB/kicad_ci_test

@soundmonster
Copy link

I'm running into the same type of timeout but for pcbnew. It's not necessarily a timeout as such, but this dialog getting in the way.
Screenshot 2021-12-01 at 18 48 43

I'm investigating what's causing it and how to get rid of it.

@soundmonster
Copy link

I've had a closer look at it. What is causing the problem is this:

  • This dialog seems to be something that Kicad shows by default on first run, at least in this version of Kicad
  • It's possible to prevent this by putting this file under $HOME/.config/kicad. This project does that in Dockerfile-base, copying this file to /root/.config/kicad.
  • GitHub injects its own part of the filesystem in a container action under /github
  • GitHub also sets a bunch of environment variables, including HOME being now /github/home
  • Kicad starts and expects the aforementioned file under /github/home/.config/kicad, but it's not there, it's under /root/.config/kicad
  • Kicad shows the dialog and all our scripts hang

To mitigate, make the entry point look like something like this:

  entrypoint: '/bin/sh'
  args:
    - '-c'
    # GH actions set $HOME to a weird location and we have to move Kicad settings there first
    - |
      mkdir -p $HOME/.config/kicad ;
      cp /root/.config/kicad/* $HOME/.config/kicad ;
      # run your script here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants