[libvirt-jenkins-ci PATCH 02/18] ansible: Add initial support for building projects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Building projects is entirely controlled by Jenkins in a production
environment, but it can be useful to trigger builds via Ansible
during development to figure out build dependencies and for sanity
checking purposes.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 ansible/group_vars/all/main.yml |  8 ++++++++
 ansible/site.yml                | 12 ++++++++++++
 ansible/tasks/build.yml         | 14 ++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 ansible/tasks/build.yml

diff --git a/ansible/group_vars/all/main.yml b/ansible/group_vars/all/main.yml
index e8d3cb6..cd97458 100644
--- a/ansible/group_vars/all/main.yml
+++ b/ansible/group_vars/all/main.yml
@@ -6,3 +6,11 @@ bash: /bin/bash
 java: /usr/bin/java
 make: /usr/bin/make
 sudo: /usr/bin/sudo
+
+# Wether to build software. While this is useful for figuring out build
+# dependencies, it should not be turned on in production because it causes
+# extra packages to be installed, which can interfere with the CI jobs
+build: false
+
+# How many parallel jobs to use when building software
+smp: 3
diff --git a/ansible/site.yml b/ansible/site.yml
index 27af6de..4603a59 100644
--- a/ansible/site.yml
+++ b/ansible/site.yml
@@ -15,3 +15,15 @@
         loop_var: project
       when:
         - projects is defined
+
+    - include: tasks/build.yml
+      with_items:
+        '{{ projects }}'
+      loop_control:
+        loop_var: project
+      when:
+        - projects is defined
+        # base is a pseudo-projects
+        - project != 'base'
+        # Building can be turned on and off
+        - build
diff --git a/ansible/tasks/build.yml b/ansible/tasks/build.yml
new file mode 100644
index 0000000..edb0064
--- /dev/null
+++ b/ansible/tasks/build.yml
@@ -0,0 +1,14 @@
+---
+- name: '{{ project }}: Load variables'
+  include_vars:
+    file: 'vars/{{ project }}/{{ os_name }}-{{ os_version }}.yml'
+
+- name: '{{ project }}: Drop local changes'
+  command: git reset --hard
+  args:
+    chdir: '{{ project }}'
+
+- name: '{{ project }}: Clean up'
+  command: git clean -xdf
+  args:
+    chdir: '{{ project }}'
-- 
2.13.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux