--- /dev/null
+#!/bin/bash
+
+# the following two methods exist in scripts/build_utils.sh
+pkgs=( "ansible" "tox" )
+install_python_packages "pkgs[@]"
+
+# run ansible to get this current host to meet our requirements, specifying
+# a local connection and 'localhost' as the host where to execute
+cd "$WORKSPACE/ceph-build/chacra-pull-requests/setup/playbooks"
+$VENV/ansible-playbook -i "localhost," -c local setup.yml
+
+$VENV/tox -rv
--- /dev/null
+- scm:
+ name: chacra
+ scm:
+ - git:
+ url: https://github.com/ceph/chacra
+ branches:
+ - ${sha1}
+ refspec: +refs/pull/*:refs/remotes/origin/pr/*
+ browser: auto
+ timeout: 20
+ skip-tag: true
+ wipe-workspace: true
+
+- scm:
+ name: ceph-build
+ scm:
+ - git:
+ url: https://github.com/ceph/ceph-build.git
+ browser-url: https://github.com/ceph/ceph-build
+ timeout: 20
+ skip-tag: true
+ wipe-workspace: false
+ basedir: "ceph-build"
+ branches:
+ - origin/master
+
+
+- job:
+ name: chacra-pull-requests
+ description: Runs tox tests for chacra on each GitHub PR
+ project-type: freestyle
+ node: trusty && small
+ block-downstream: false
+ block-upstream: false
+ defaults: global
+ display-name: 'chacra: Pull Requests'
+ quiet-period: 5
+ retry-count: 3
+
+ logrotate:
+ daysToKeep: 15
+ numToKeep: 30
+ artifactDaysToKeep: 15
+ artifactNumToKeep: 15
+
+ properties:
+ - github:
+ url: https://github.com/ceph/chacra/
+
+ parameters:
+ - string:
+ name: sha1
+ description: "A pull request ID, like 'origin/pr/72/head'"
+
+ triggers:
+ - github-pull-request:
+ admin-list:
+ - alfredodeza
+ - dmick
+ - ktdreyer
+ - andrewschoen
+ org-list:
+ - ceph
+ only-trigger-phrase: false
+ github-hooks: true
+ permit-all: false
+ auto-close-on-fail: false
+
+ scm:
+ - chacra
+ - ceph-build
+
+ builders:
+ - shell:
+ !include-raw:
+ - ../../../scripts/build_utils.sh
+ - ../../build/build
--- /dev/null
+---
+
+- hosts: localhost
+ user: jenkins-build
+ sudo: True
+
+ tasks:
+ - include: tasks/postgresql.yml
--- /dev/null
+---
+- name: update apt cache
+ apt:
+ update_cache: yes
+ sudo: yes
+
+- name: install postgresql requirements
+ sudo: yes
+ apt:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - postgresql
+ - postgresql-common
+ - postgresql-contrib
+ tags:
+ - packages
+
+- name: ensure database service is up
+ service:
+ name: postgresql
+ state: started
+ enabled: yes
+ sudo: yes
+
+- name: allow users to connect locally
+ sudo: yes
+ lineinfile:
+ # TODO: should not hardcode that version
+ dest: /etc/postgresql/9.5/main/pg_hba.conf
+ regexp: '^host\s+all\s+all\s+127.0.0.1/32'
+ line: 'host all all 127.0.0.1/32 md5'
+ backrefs: yes
+ register: pg_hba_conf
+
+- service:
+ name: postgresql
+ state: restarted
+ sudo: true
+ when: pg_hba_conf.changed