[Buildbot-devel] installer for windows buildslave?

Olivier Trempe oliviertrempe at gmail.com
Fri Jan 31 20:07:53 UTC 2014


Philippe McLean <philippe.mclean at ...> writes:

> 
> The online instructions for installing buildbot as a windows slave have a 
number of manual steps especially when adjusting the registry.
> Has anyone spent time automating these steps? (Powershell?)
> 
> 
> thanks
> Phil
> 
> 
> --------------------------------------------------------------------------
----
> WatchGuard Dimension instantly turns raw network data into actionable 
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?
id=123612991&iu=/4140/ostg.clktrk
> 
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at ...
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
> 



Hi Phil,

I didn't follow these instructions for installing and running buildbot as 
windows slave.

Here's what I did:
1. Create a python virtualenv for buildbot
2. Activate the virtualenv
3. Install PyWin32 in the virtualenv
4. Install buildbot-slave in the virtualenv
5. Create a slave in the virtualenv
6. Deactivate the virtualenv
7. Install nssm
8. Configure nssm to launch the buildbot slave
9. Start the buildbot slave service


I manage all those steps with Saltstack.

Below is the Saltstack's sls file to manage my buildbot slaves. If you are 
not familiar with Saltstack, dive into their doc to understand how it works.

Enjoy!

buildbot_slave.sls-------------------------------------------------
{% set buildbot_dir = pillar['buildbot_slaves'][grains['nodename']]
['buildbot_dir'] %}
{% set venv_dir = buildbot_dir + '/venv' %}
{% set slave_dir = buildbot_dir + '/slave' %}

{% if grains['os'] == 'Windows' %}
    {% set bin_dir = venv_dir + '/Scripts' %}
    {% set activate_venv = bin_dir + '/activate.bat' %}
    {% set buildslave_cmd = bin_dir + '/buildslave.bat' %}
{% else %}
    {% set bin_dir = venv_dir + '/bin' %}
    {% set activate_venv = 'source ' + bin_dir + '/activate' %}
    {% set buildslave_cmd = bin_dir + '/buildslave' %}
{% endif %}



include:
    - {{ pillar['pkg']['service'] }}
    - python.virtualenv



{% if grains['os'] != 'Windows' %}
buildbot_slave_user:
    user.present:
        - name: {{ pillar['buildbot_slave_params']['user'] }}
        - password: {{ pillar['buildbot_slave_params']['user_password'] }}
        - enforce_password: False
        - shell: /bin/bash
{% endif %}


buildbot_slave_venv:
    virtualenv.managed:
        - name: {{ venv_dir }}
{% if grains['os'] != 'Windows' %}
        - user: {{ pillar['buildbot_slave_params']['user'] }}
{% endif %}
        - require:
            - pip: virtualenv

{% if grains['os'] == 'Windows' %}
buildbot_slave_pywin32:
    cmd.run:
        - name: {{ activate_venv }} & easy_install {{ 
pillar['salt_resources'] }}/python/pywin32-218.win32-py2.7.exe
        - unless: {{ activate_venv }} & python -c "import win32process"
        - cwd: {{ venv_dir }}
        - require:
            - virtualenv: buildbot_slave_venv
{% endif %}


buildbot_slave_install:
    pip.installed:
        - name: buildbot-slave==0.8.8
        - bin_env: {{ venv_dir }}
        - proxy: {{ pillar['http_proxy'] }}
{% if grains['os'] != 'Windows' %}
        - user: {{ pillar['buildbot_slave_params']['user'] }}
{% endif %}
        - require:
            - virtualenv: buildbot_slave_venv
{% if grains['os'] == 'Windows' %}
            - cmd: buildbot_slave_pywin32
{% endif %}


buildbot_slave_create:
    file.managed:
        - name: {{ slave_dir }}/validate_slave_config.py
        - source: salt://buildbot/validate_slave_config.py
{% if grains['os'] != 'Windows' %}
        - user: {{ pillar['buildbot_slave_params']['user'] }}
{% endif %}
        - require:
            - pip: buildbot_slave_install
    cmd.run:
        - name: {{ activate_venv }} && buildslave create-slave --force --
relocatable {{ slave_dir }} {{ pillar['buildbot']['host'] }}:{{ 
pillar['buildbot']['port'] }} {{ grains['nodename'] }} {{ pillar['buildbot']
['password'] }}
        - unless: {{ activate_venv }} && python {{ slave_dir 
}}/validate_slave_config.py {{ pillar['buildbot']['host'] }} {{ 
pillar['buildbot']['port'] }} {{ grains['nodename'] }} {{ pillar['buildbot']
['password'] }}
        - cwd: {{ slave_dir }}
{% if grains['os'] != 'Windows' %}
        - shell: /bin/bash
        - user: {{ pillar['buildbot_slave_params']['user'] }}
{% endif %}
        - require:
            - file: buildbot_slave_create

buildbot_slave_tac_new:
    cmd.run:
{% if grains['os'] == 'Windows' %}
        - name: move /y buildbot.tac.new buildbot.tac
        - onlyif: if exist buildbot.tac.new (exit 0) else (exit 1)
{% else %}
        - name: mv -f buildbot.tac.new buildbot.tac
        - onlyif: test -f buildbot.tac.new
{% endif %}
        - cwd: {{ slave_dir }}
        - require:
            - cmd: buildbot_slave_create


buildbot_slave_service:
{% if grains['os_family'] == 'Windows' %}
{% from 'nssm/init.sls' import nssm_exe with context %}
    cmd.run:
        - name: {{ nssm_exe }} install buildbot-slave {{ buildslave_cmd }} 
start --nodaemon {{ slave_dir }}
        - unless: sc query state= all | find "buildbot-slave"
        - require:
            - cmd: buildbot_slave_create
            - file: nssm
{% elif grains['os_family'] == 'Debian' %}
    file.managed:
        - name: /etc/init/buildbot-slave.conf
        - source: salt://buildbot/buildbot-slave_upstart
        - template: jinja
        - defaults:
            buildbot_user: {{ pillar['buildbot_slave_params']['user'] }}
            bin_dir: {{ bin_dir }}
            slave_dir: {{ slave_dir }}
        - require:
            - pkg: {{ pillar['pkg']['service'] }}
    cmd.wait:
        - name: initctl reload-configuration
        - watch:
            - file: buildbot_slave_service
{% endif %}
    service.running:
        - name: buildbot-slave
        - enable: True
        - require:
            - cmd: buildbot_slave_service
buildbot_slave.sls-------------------------------------------------







More information about the devel mailing list