launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28332
[Merge] ~cjwatson/launchpad-buildd:fix-shallow-clones into launchpad-buildd:master
Colin Watson has proposed merging ~cjwatson/launchpad-buildd:fix-shallow-clones into launchpad-buildd:master.
Commit message:
Fix use of shallow clones for OCI builds
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1968630 in launchpad-buildd: "OCI recipes are failing to set sources"
https://bugs.launchpad.net/launchpad-buildd/+bug/1968630
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/419243
This regressed in version 211, since "git clone --depth 1" no longer clones the history of the correct branch when the -b option isn't used. Adding --no-single-branch works around this.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:fix-shallow-clones into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index e0f1e30..2ebc61f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
launchpad-buildd (212) UNRELEASED; urgency=medium
* Ensure that launchpad-buildd runs with lxd as a supplementary group.
+ * Fix use of shallow clones for OCI builds, which regressed in version 211
+ (LP: #1968630).
-- Colin Watson <cjwatson@xxxxxxxxxx> Wed, 06 Apr 2022 12:46:35 +0100
diff --git a/lpbuildd/target/tests/test_build_oci.py b/lpbuildd/target/tests/test_build_oci.py
index add1f86..7e9c916 100644
--- a/lpbuildd/target/tests/test_build_oci.py
+++ b/lpbuildd/target/tests/test_build_oci.py
@@ -179,7 +179,8 @@ class TestBuildOCI(TestCase):
build_oci.repo()
self.assertThat(build_oci.backend.run.calls, MatchesListwise([
RanBuildCommand(
- ["git", "clone", "-n", "--depth", "1", "lp:foo", "test-image"],
+ ["git", "clone", "-n", "--depth", "1", "--no-single-branch",
+ "lp:foo", "test-image"],
cwd="/home/buildd"),
RanBuildCommand(
["git", "checkout", "-q", "HEAD"],
@@ -201,7 +202,8 @@ class TestBuildOCI(TestCase):
build_oci.repo()
self.assertThat(build_oci.backend.run.calls, MatchesListwise([
RanBuildCommand(
- ["git", "clone", "-n", "--depth", "1", "lp:foo", "test-image"],
+ ["git", "clone", "-n", "--depth", "1", "--no-single-branch",
+ "lp:foo", "test-image"],
cwd="/home/buildd"),
RanBuildCommand(
["git", "checkout", "-q", "next"],
@@ -224,7 +226,8 @@ class TestBuildOCI(TestCase):
build_oci.repo()
self.assertThat(build_oci.backend.run.calls, MatchesListwise([
RanBuildCommand(
- ["git", "clone", "-n", "--depth", "1", "lp:foo", "test-image"],
+ ["git", "clone", "-n", "--depth", "1", "--no-single-branch",
+ "lp:foo", "test-image"],
cwd="/home/buildd"),
RanBuildCommand(
["git", "checkout", "-q", "refs/tags/1.0"],
@@ -254,7 +257,8 @@ class TestBuildOCI(TestCase):
}
self.assertThat(build_oci.backend.run.calls, MatchesListwise([
RanBuildCommand(
- ["git", "clone", "-n", "--depth", "1", "lp:foo", "test-image"],
+ ["git", "clone", "-n", "--depth", "1", "--no-single-branch",
+ "lp:foo", "test-image"],
cwd="/home/buildd", **env),
RanBuildCommand(
["git", "checkout", "-q", "HEAD"],
diff --git a/lpbuildd/target/vcs.py b/lpbuildd/target/vcs.py
index fadc2c3..6cb0b8f 100644
--- a/lpbuildd/target/vcs.py
+++ b/lpbuildd/target/vcs.py
@@ -74,7 +74,7 @@ class VCSOperationMixin(StatusOperationMixin):
if quiet:
cmd.append("-q")
if git_shallow_clone:
- cmd.extend(["--depth", "1"])
+ cmd.extend(["--depth", "1", "--no-single-branch"])
cmd.extend([self.args.git_repository, name])
if not self.ssl_verify:
env["GIT_SSL_NO_VERIFY"] = "1"