[libvirt] [jenkins-ci PATCH v2] guests: Introduce a var to enable shallow git clones for projects

Erik Skultety posted 1 patch 4 years, 7 months ago
Failed in applying to current master (apply log)
guests/group_vars/all/main.yml          | 2 ++
guests/playbooks/build/jobs/prepare.yml | 1 +
2 files changed, 3 insertions(+)
[libvirt] [jenkins-ci PATCH v2] guests: Introduce a var to enable shallow git clones for projects
Posted by Erik Skultety 4 years, 7 months ago
First of all, we don't need the full history for builds and we can save
some time during the prepare phase. The disk footprint is about 5x
smaller, but the most important thing is the repo clone duration
difference e.g. in libvirt's case is quite significant:

full history:
real 3m45.236s
user 1m53.074s
sys 0m15.577s

depth 1:
real 0m14.868s
user 0m2.215s
sys 0m0.906s

Since jenkins has a local copy and doesn't clone from the internet, this
patch modifies only the configs for local VMs.
---
 guests/group_vars/all/main.yml          | 2 ++
 guests/playbooks/build/jobs/prepare.yml | 1 +
 2 files changed, 3 insertions(+)

diff --git a/guests/group_vars/all/main.yml b/guests/group_vars/all/main.yml
index b73795e..6efcb52 100644
--- a/guests/group_vars/all/main.yml
+++ b/guests/group_vars/all/main.yml
@@ -5,3 +5,5 @@
 ansible_ssh_pass: root
 
 jenkins_url: https://ci.centos.org/computer/{{ inventory_hostname }}/slave-agent.jnlp
+
+git_shallow_clone: true
diff --git a/guests/playbooks/build/jobs/prepare.yml b/guests/playbooks/build/jobs/prepare.yml
index 576afbc..477c169 100644
--- a/guests/playbooks/build/jobs/prepare.yml
+++ b/guests/playbooks/build/jobs/prepare.yml
@@ -5,6 +5,7 @@
     version: '{{ git_branch }}'
     dest: '{{ name }}'
     force: yes
+    depth: '{{ git_shallow_clone | ternary(1, omit) }}'
   when:
     - inventory_hostname in machines
 
-- 
2.20.1

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