Skip to content

Commit

Permalink
Merge pull request #4 from arBmind/develop
Browse files Browse the repository at this point in the history
upgraded codebase - buildbot 0.9.0rc1, Ansible 2.1
  • Loading branch information
arBmind committed Aug 5, 2016
2 parents b691306 + 6a80497 commit e753ed9
Show file tree
Hide file tree
Showing 60 changed files with 529 additions and 497 deletions.
12 changes: 6 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Content Roles
* **master/stop** stop the buildbot master
* **project/add** add a project to the inplace buildbot master
* **project/kill** remove a project from the inplace buildbot master
* **slave/create** install a buildslave and add it to the buildbot master
* **slave/start** start a buildslave
* **winslave/create** install a buildslave and add it to the buildbot master
* **winslave/start** start a buildslave
* **worker/create** install a worker and add it to the buildbot master
* **worker/start** start a worker
* **winworker/create** install a windows worker and add it to the buildbot master
* **winworker/start** start a windows worker

Dependencies
------------
Expand All @@ -44,7 +44,7 @@ Changelog

* Essentials to configure and run Buildbot installation
* Buildbot master with inplace configuration
* Buildbot slaves for Windows and Ubuntu
* Buildbot worker for Windows and Ubuntu
* Git support for projects

Roadmap
Expand All @@ -53,7 +53,7 @@ Roadmap
* SCM
* ☐ Git hosted projects
* ☐ SVN hosted projects
* Buildbot slaves on
* Buildbot worker on
* ☐ MacOS
* ☐ CentOS
* Your ideas
Expand Down
2 changes: 1 addition & 1 deletion master/create/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: restart buildmaster
- name: restart buildbot master
file:
path: "{{ buildbot_master_basedir }}/restart.txt"
state: touch
18 changes: 9 additions & 9 deletions master/create/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@

- name: Create Master
command: 'buildbot create-master {{ buildbot_master_basedir }}'
sudo: yes
sudo_user: '{{ buildbot_master_user }}'
become: yes
become_user: '{{ buildbot_master_user }}'
args:
creates: '{{ buildbot_master_basedir }}/buildbot.tac'
register: buildbot_master_create_result
notify:
- restart buildmaster
- restart buildbot master

- name: Upgrade Master
command: 'buildbot upgrade-master {{ buildbot_master_basedir }}'
sudo: yes
sudo_user: '{{ buildbot_master_user }}'
become: yes
become_user: '{{ buildbot_master_user }}'
when: >
buildbot_master_git_result.changed
((buildbot_master_pip_result | default({})).changed | default(False))
and not buildbot_master_create_result.changed
notify:
- restart buildmaster
- restart buildbot master

- name: store facts
set_fact:
buildbot_master_basedir: '{{ buildbot_master_basedir }}'
buildbot_master_user: '{{ buildbot_master_user }}'
tags:
- facts
tags: [always]

6 changes: 3 additions & 3 deletions master/inplace-config/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ buildbot_master_inplace_name: "inplace"
buildbot_master_inplace_dest: "{{ buildbot_master_basedir }}/{{ buildbot_master_inplace_name }}"

# extra configuration folders
buildbot_master_slaves_dir: '{{ buildbot_master_basedir }}/slaves'
buildbot_master_projects_dir: '{{ buildbot_master_basedir }}/projects'
buildbot_master_workers_dir: 'workers'
buildbot_master_projects_dir: 'projects'

# configurations for master.cfg
buildbot_master_title: "My Buildbot"
buildbot_master_title_url: "https://hicknhack-software.com"
buildbot_master_www_port: 8020
buildbot_master_url: "http://localhost:{{ buildbot_master_www_port }}/"
buildbot_master_slave_port: 9989
buildbot_master_worker_port: 9989
2 changes: 1 addition & 1 deletion master/inplace-config/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: reconfig buildmaster
- name: reconfigure buildbot master
file:
path: "{{ buildbot_master_basedir }}/reconfig.txt"
state: touch
28 changes: 15 additions & 13 deletions master/inplace-config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,34 @@
repo: "{{ buildbot_master_inplace_repo }}"
version: "{{ buildbot_master_inplace_version }}"
dest: '{{ buildbot_master_inplace_dest }}'
sudo: yes
sudo_user: '{{ buildbot_master_user }}'
become: yes
become_user: '{{ buildbot_master_user }}'
tags: [git]

- name: Folders
file:
dest: '{{ item }}'
dest: '{{ buildbot_master_basedir }}/{{ item }}'
state: directory
sudo: yes
sudo_user: '{{ buildbot_master_user }}'
owner: '{{ buildbot_master_user }}'
group: '{{ buildbot_master_user }}'
with_items:
- '{{ buildbot_master_slaves_dir }}'
- '{{ buildbot_master_workers_dir }}'
- '{{ buildbot_master_projects_dir }}'

- name: Default Configuration
template:
src: 'master.cfg.j2'
dest: "{{ buildbot_master_basedir }}/master.cfg"
sudo: yes
sudo_user: '{{ buildbot_master_user }}'
owner: '{{ buildbot_master_user }}'
group: '{{ buildbot_master_user }}'
notify:
- reconfig buildmaster
- reconfigure buildbot master

- name: store facts
set_fact:
buildbot_master_slaves_dir: '{{ buildbot_master_slaves_dir }}'
buildbot_master_workers_dir: '{{ buildbot_master_workers_dir }}'
buildbot_master_projects_dir: '{{ buildbot_master_projects_dir }}'
buildbot_master_slave_port: '{{ buildbot_master_slave_port }}'
tags:
- facts
buildbot_master_workers_path: '{{ buildbot_master_workers_path }}'
buildbot_master_projects_path: '{{ buildbot_master_projects_path }}'
buildbot_master_worker_port: '{{ buildbot_master_worker_port }}'
tags: [always]
38 changes: 25 additions & 13 deletions master/inplace-config/templates/master.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,33 @@
# ex: set syntax=python:
# {{ ansible_managed }}

import os
from buildbot.plugins import *
from {{ buildbot_master_inplace_name }}.common import config, loaders
from {{ buildbot_master_inplace_name }}.factories import reconfig
import sys
sys.path.append('inplace')
from buildbot_inplace import InplaceConfig

reload(config)
reload(loaders)
reload(reconfig)
import buildbot_inplace
reload(buildbot_inplace)

cfg = config.BuildbotConfigurationWrapper()
cfg.setTitle("{{ buildbot_master_title }}")
cfg.setTitleUrl("{{ buildbot_master_title_url }}")
cfg.setConnection("{{ buildbot_master_url }}", {{ buildbot_master_slave_port }})
c = BuildmasterConfig = InplaceConfig()
c['protocols'] = {'pb': dict(port={{ buildbot_master_worker_port }})}

slaveNames = loaders.SlaveLoader.load(cfg, os.path.join(os.getcwd(), 'slaves/'))
loaders.ProjectLoader.load(cfg, os.path.join(os.getcwd(), 'projects/'), slaveNames)
# loading workers makes it easier to extend
c.load_workers('{{ buildbot_master_workers_dir }}')

c = BuildmasterConfig = cfg.getConfigDict()
# loading projects
c.load_projects('{{ buildbot_master_projects_dir }}')

# TODO: add status targets
c['status'] = []

c['title'] = "{{ buildbot_master_title }}"
c['titleURL'] = "{{ buildbot_master_title_url }}"

c['buildbotURL'] = "{{ buildbot_master_url }}"
c['www'] = dict(port={{ buildbot_master_www_port }}, plugins=dict(waterfall_view={}, console_view={}))

c['db'] = {'db_url': "sqlite:///state.sqlite"}

# add change_source, schedulers and builders for all projects and workers
c.setup_inplace()
4 changes: 4 additions & 0 deletions master/inplace-config/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
# extra configuration folders
buildbot_master_workers_path: '{{ buildbot_master_basedir }}/{{ buildbot_master_workers_dir }}'
buildbot_master_projects_path: '{{ buildbot_master_basedir }}/{{ buildbot_master_projects_dir }}'
6 changes: 2 additions & 4 deletions master/install-nine/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
buildbot_master_repo: https://github.com/buildbot/buildbot.git
buildbot_master_repo_version: 0bc3a370b0885b9ddac8b97fe28eed83713d31cf
buildbot_master_repo_update: no
buildbot_version: '0.9.0rc1'

# location where buildbot is installed to
buildbot_master_path: /opt/buildbot
buildbot_master_path: /var/buildbot
2 changes: 1 addition & 1 deletion master/install-nine/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: restart buildmasters
- name: restart buildbot masters
file:
path: "{{ buildbot_master_path }}/restart.txt"
state: touch
80 changes: 20 additions & 60 deletions master/install-nine/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,40 @@
---
- name: Add PPA
apt_repository:
repo: "{{ item }}"
with_items: buildbot_master_apt_ppas

- name: install APT packages
apt:
name: "{{ item }}"
update_cache: yes
state: latest
cache_valid_time: 86400
with_items: buildbot_master_apt_packages
with_items: "{{ buildbot_master_apt_packages }}"

- name: Install NPM packages
npm:
global: yes
name: "{{ item }}"
with_items: buildbot_master_npm_packages
- name: update pip
pip:
name: pip
state: latest

- name: Install PIP packages
pip:
name: "{{ item }}"
with_items: buildbot_master_pip_packages
with_items: "{{ buildbot_master_pip_packages }}"

- name: Git checkout
git:
repo: "{{ buildbot_master_repo }}"
version: "{{ buildbot_master_repo_version }}"
dest: '{{ buildbot_master_path }}'
update: '{{ buildbot_master_repo_update }}'
register: buildbot_master_git_result
- name: Install PIP buildbot
pip:
name: "{{ item }}"
version: "{{ buildbot_version }}"
notify:
- restart buildmasters

# data not available
# - name: Stop for Update
# command: 'buildbot stop {{ buildbot_master_basedir }}'
# failed_when: no
# when: buildbot_master_git_result.changed

- name: Clean for Update
file:
path: '{{ item }}'
state: absent
when: buildbot_master_git_result.changed
- restart buildbot masters
with_items:
- '{{ buildbot_master_path }}/pkg/buildbot_pkg.egg-info'
- '{{ buildbot_master_path }}/master/buildbot.egg-info'
- '{{ buildbot_master_path }}/www/base/buildbot_www.egg-info'

- name: Install Pkg
command: 'pip install --editable pkg'
args:
chdir: '{{ buildbot_master_path }}'
creates: '{{ buildbot_master_path }}/pkg/buildbot_pkg.egg-info'
notify:
- restart buildmasters
- buildbot
- buildbot-www
- buildbot-waterfall-view
- buildbot-console-view

- name: Install Master
command: 'pip install --editable master'
args:
chdir: '{{ buildbot_master_path }}'
creates: '{{ buildbot_master_path }}/master/buildbot.egg-info'
notify:
- restart buildmasters

- name: Build Frontend
command: 'make frontend'
args:
chdir: '{{ buildbot_master_path }}'
creates: '{{ buildbot_master_path }}/www/base/buildbot_www.egg-info'
notify:
- restart buildmasters
- name: Path
file:
path: "{{ buildbot_master_path }}"
state: directory

- name: Store Facts
set_fact:
buildbot_master_path: '{{ buildbot_master_path }}'
tags:
- facts
tags: [always]
8 changes: 0 additions & 8 deletions master/install-nine/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
---
buildbot_master_apt_ppas:
- 'ppa:chris-lea/node.js'

buildbot_master_apt_packages:
- git # required to checkout
- nodejs # required for gulp
- python-pip # required for buildbot pip
- build-essential # required for building buildbot package
- python-dev # required for compiling
- libffi-dev # pyopenssl

buildbot_master_npm_packages:
- gulp

buildbot_master_pip_packages:
- pyopenssl
- jrnl
- service_identity
16 changes: 8 additions & 8 deletions master/start-inplace/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
state: absent
register: buildbot_master_restart_remove

- name: restart buildmaster
- name: restart buildbot master
shell: |
set -e
if [ -n "$(ls -A {{ buildbot_master_slaves_dir }})" -a -n "$(ls -A {{ buildbot_master_projects_dir }})" ]; then
if [ -n "$(ls -A {{ buildbot_master_workers_path }})" -a -n "$(ls -A {{ buildbot_master_projects_path }})" ]; then
buildbot restart {{ buildbot_master_basedir }} || buildbot start {{ buildbot_master_basedir }}
fi
sudo: yes
sudo_user: '{{ buildbot_master_user }}'
become: yes
become_user: '{{ buildbot_master_user }}'
when: buildbot_master_restart_remove.changed

- name: Check for Reconfigure
Expand All @@ -35,14 +35,14 @@
state: absent
register: buildbot_master_reconfig_remove

- name: reconfigure buildmaster
- name: reconfigure buildbot master
shell: |
set -e
if [ -n "$(ls -A {{ buildbot_master_slaves_dir }})" -a -n "$(ls -A {{ buildbot_master_projects_dir }})" ]; then
if [ -n "$(ls -A {{ buildbot_master_workers_path }})" -a -n "$(ls -A {{ buildbot_master_projects_path }})" ]; then
buildbot reconfig {{ buildbot_master_basedir }} || buildbot start {{ buildbot_master_basedir }}
fi
sudo: yes
sudo_user: '{{ buildbot_master_user }}'
become: yes
become_user: '{{ buildbot_master_user }}'
when: >
buildbot_master_reconfig_remove.changed
and not buildbot_master_restart_remove.changed

0 comments on commit e753ed9

Please sign in to comment.