Skip to content

Tips and Tricks

qu1ck edited this page Feb 6, 2023 · 5 revisions

Running in headless environment

For reasons this plugin depends on graphical environment to work, even in command line mode. This can be an issue when you are trying to run it in headless environment like a remote CI server. Workaround is to install a dummy X server and point python process to it.

Note: reason #2 in comment linked above is no longer relevant as config is not read in cli mode.

Xvfb is one of such fake X servers and is available on most distributions. It provides an easy to use xvfb-run utility that launches any process in an X environment with valid $DISPLAY.

@damped provided a nice gitlab CI config example that shows how to use xvfb:

image: ubuntu:16.04
#Will save to https://<usrname>.gitlab.io/<repository>/ibom.html

pages:
        script:
                #PCB path name relative to the root of the repository
                - PCBPATH="pcb/pcb.kicad_pcb"
                - ARGS="--layer-view F"
                - apt-get update -qq && apt-get install -y software-properties-common xvfb git
                - add-apt-repository ppa:js-reynaud/kicad-5
                - apt-get update -qq && apt-get install -y --no-install-recommends kicad
                - git clone https://github.com/openscopeproject/InteractiveHtmlBom.git

                - mkdir public
                - CURRENTDIR=$(pwd)
                - xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python2 InteractiveHtmlBom/InteractiveHtmlBom/generate_interactive_bom.py --no-browser $ARGS $PCBPATH --dest-dir $CURRENTDIR/public

        artifacts:
                paths:
                        - public
        only:
                - master

A bit more context is available in issue #65

User @zen shared Drone CI/CD plugin that runs InteractiveHtmlBom: https://hub.docker.com/r/surgecloud/drone-kicad-ibom/

There is also @Granjow's Dockerfile for a container image with xvfb and ibom: https://git.granjow.net/escape/rnd/docker-interactive-bom

Alternative option

Another way to avoid dependency on graphical server is to set INTERACTIVE_HTML_BOM_NO_DISPLAY environment variable. Do so at your own risk as this does not solve wxgtk bugs. If you run into problems with unicode filenames try running ibom without the variable set and see if the issue reproduces.

Clone this wiki locally