qemu-devel
[Top][All Lists]
Advanced

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

[RFC PATCH] ci: ensure that all jobs use a shallow clone


From: Paolo Bonzini
Subject: [RFC PATCH] ci: ensure that all jobs use a shallow clone
Date: Thu, 7 Jan 2021 18:17:19 +0100

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]