]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
Adds the chacra-pull-requests job
authorAndrew Schoen <aschoen@redhat.com>
Wed, 22 Jun 2016 21:23:25 +0000 (16:23 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 23 Jun 2016 20:18:28 +0000 (15:18 -0500)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
chacra-pull-requests/build/build [new file with mode: 0644]
chacra-pull-requests/config/definitions/chacra-pull-requests.yml [new file with mode: 0644]
chacra-pull-requests/setup/playbooks/setup.yml [new file with mode: 0644]
chacra-pull-requests/setup/playbooks/tasks/postgresql.yml [new file with mode: 0644]

diff --git a/chacra-pull-requests/build/build b/chacra-pull-requests/build/build
new file mode 100644 (file)
index 0000000..37fe4f1
--- /dev/null
@@ -0,0 +1,12 @@
+#!/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
diff --git a/chacra-pull-requests/config/definitions/chacra-pull-requests.yml b/chacra-pull-requests/config/definitions/chacra-pull-requests.yml
new file mode 100644 (file)
index 0000000..1347295
--- /dev/null
@@ -0,0 +1,77 @@
+- 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
diff --git a/chacra-pull-requests/setup/playbooks/setup.yml b/chacra-pull-requests/setup/playbooks/setup.yml
new file mode 100644 (file)
index 0000000..04dc83a
--- /dev/null
@@ -0,0 +1,8 @@
+---
+
+- hosts: localhost
+  user: jenkins-build
+  sudo: True
+
+  tasks:
+     - include: tasks/postgresql.yml
diff --git a/chacra-pull-requests/setup/playbooks/tasks/postgresql.yml b/chacra-pull-requests/setup/playbooks/tasks/postgresql.yml
new file mode 100644 (file)
index 0000000..4e1f3d6
--- /dev/null
@@ -0,0 +1,40 @@
+---
+- 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