All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, stefanha@redhat.com
Subject: [RFC PATCH] ci: ensure that all jobs use a shallow clone
Date: Thu,  7 Jan 2021 18:17:19 +0100	[thread overview]
Message-ID: <20210107171719.477856-1-pbonzini@redhat.com> (raw)

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	other threads:[~2021-01-07 17:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 17:17 Paolo Bonzini [this message]
2021-01-07 18:28 ` [RFC PATCH] ci: ensure that all jobs use a shallow clone 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é

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210107171719.477856-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.