[libvirt] [jenkins-ci PATCH 7/8] lcitool: Allow installing a subset of build dependencies

Andrea Bolognani abologna at redhat.com
Thu Jul 19 16:32:07 UTC 2018


For CentOS CI, we need build dependencies for all known
projects to be installed; however, when using lcitool
for development purposes, it is very convenient to install
just the subset relevant to the project that's being
worked on, as doing so reduces the storage requirements
and makes the update procedure quite a bit faster.

The previous behavior can still be obtained by using

  $ lcitool -a update -p all ...

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 guests/lcitool                   | 4 +++-
 guests/playbooks/update/main.yml | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 96a59ac..2aa9674 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -430,7 +430,7 @@ class Application:
             except Exception:
                 raise Error("Failed to install '{}'".format(host))
 
-    def _action_update(self, hosts, _projects):
+    def _action_update(self, hosts, projects):
         base = Util.get_base()
 
         flavor = self._config.get_flavor()
@@ -438,6 +438,7 @@ class Application:
         root_pass_file = self._config.get_root_password_file()
 
         ansible_hosts = ",".join(self._inventory.expand_pattern(hosts))
+        selected_projects = self._projects.expand_pattern(projects)
 
         ansible_cfg_path = os.path.join(base, "ansible.cfg")
         playbook_base = os.path.join(base, "playbooks", "update")
@@ -448,6 +449,7 @@ class Application:
             "playbook_base": playbook_base,
             "root_password_file": root_pass_file,
             "flavor": flavor,
+            "selected_projects": selected_projects,
         })
 
         cmd = [
diff --git a/guests/playbooks/update/main.yml b/guests/playbooks/update/main.yml
index 4de759b..753bac4 100644
--- a/guests/playbooks/update/main.yml
+++ b/guests/playbooks/update/main.yml
@@ -34,11 +34,11 @@
     # Install build dependencies for each project
     - include: '{{ playbook_base }}/tasks/packages.yml'
       with_items:
-        '{{ projects }}'
+        '{{ selected_projects }}'
       loop_control:
         loop_var: project
       when:
-        - projects is defined
+        - project in projects
 
     # Install packages needed for the Jenkins agent
     - include: '{{ playbook_base }}/tasks/packages.yml'
-- 
2.17.1




More information about the libvir-list mailing list