All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] ci: ensure that all jobs use a shallow clone
@ 2021-01-07 17:17 Paolo Bonzini
  2021-01-07 18:28 ` Daniel P. Berrangé
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2021-01-07 17:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, stefanha

We are still using quite a bit of bandwidth to run CI jobs, even though
GitLab has switched to gitlab.com to fetch the sources.  This is in
part because we are handling submodules ourselves and therefore those
do not use shallow clones.

Observe GitLab's GIT_DEPTH environment variable in
scripts/git-submodule.sh so that CI systems can use a shallow clone
for submodules.  Set a depth of 3 for all CI systems, for both the main
repository (using whatever native configuration mechanism is there)
and the submodules.

Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
        Completely untested, just to propose the idea.

 .cirrus.yml              | 1 +
 .gitlab-ci.yml           | 3 +++
 .shippable.yml           | 2 ++
 .travis.yml              | 2 ++
 scripts/git-submodule.sh | 2 +-
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 6f2a958472..47c2467d04 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,5 +1,6 @@
 env:
-  CIRRUS_CLONE_DEPTH: 1
+  CIRRUS_CLONE_DEPTH: 3
+  GIT_DEPTH: 3
 
 freebsd_12_task:
   freebsd_instance:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 01c9e46410..ff19a9c313 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,9 @@ stages:
   - build
   - test
 
+variables:
+  GIT_DEPTH: 3
+
 include:
   - local: '/.gitlab-ci.d/edk2.yml'
   - local: '/.gitlab-ci.d/opensbi.yml'
diff --git a/.shippable.yml b/.shippable.yml
index 14350e6de8..f2d59b478e 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -1,9 +1,11 @@
 language: c
+depth: 3
 git:
    submodules: false
 env:
   global:
     - LC_ALL=C
+    - GIT_DEPTH=3
   matrix:
     - IMAGE=debian-amd64
       TARGET_LIST=x86_64-softmmu,x86_64-linux-user
diff --git a/.travis.yml b/.travis.yml
index f2a101936c..f2a785a42b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -80,9 +80,11 @@ env:
     - CCACHE_SLOPPINESS="include_file_ctime,include_file_mtime"
     - CCACHE_MAXSIZE=1G
     - G_MESSAGES_DEBUG=error
+    - GIT_DEPTH=3
 
 
 git:
+  depth: 3
   # we want to do this ourselves
   submodules: false
 
diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh
index 65ed877aef..2886087a12 100755
--- a/scripts/git-submodule.sh
+++ b/scripts/git-submodule.sh
@@ -75,7 +75,7 @@ update)
         exit 0
     fi
 
-    $GIT submodule update --init $modules 1>/dev/null
+    $GIT submodule update ${GIT_DEPTH:+--depth "$GIT_DEPTH"} --init $modules 1>/dev/null
     test $? -ne 0 && error "failed to update modules"
 
     $GIT submodule status $modules > "${substat}"
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-08 11:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 17:17 [RFC PATCH] ci: ensure that all jobs use a shallow clone Paolo Bonzini
2021-01-07 18:28 ` Daniel P. Berrangé
2021-01-07 19:05   ` Thomas Huth
2021-01-07 19:23     ` Paolo Bonzini
2021-01-08 10:16       ` Daniel P. Berrangé
2021-01-08 11:06         ` Thomas Huth
2021-01-08 11:10           ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.