Skip to content

Tips and Tricks

qu1ck edited this page Jan 23, 2019 · 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.

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/

Clone this wiki locally