Merge ~cjwatson/launchpad-buildd:ci-chown-build-tree into launchpad-buildd:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: f3a4b80e219400ef22f7013f7917188092e8ef21
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad-buildd:ci-chown-build-tree
Merge into: launchpad-buildd:master
Diff against target: 64 lines (+13/-0)
3 files modified
debian/changelog (+8/-0)
lpbuildd/target/run_ci.py (+1/-0)
lpbuildd/target/tests/test_run_ci.py (+4/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+436371@code.launchpad.net

Commit message

In CI jobs, chown the VCS tree to buildd:buildd after fetching it

Description of the change

Otherwise lpcraft running as the buildd user can't read its .git directory. For example, this broke Launchpad's own CI jobs.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

I've going to self-approve this - it's a regression in launchpad-buildd 227 that affected Launchpad's own CI jobs, and I have a simple end-to-end test case for it on dogfood that I'll be able to run easily (https://code.dogfood.paddev.net/~cjwatson/+git/git-test).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index bb87638..e48d607 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1launchpad-buildd (228) UNRELEASED; urgency=medium
2
3 * In CI jobs, chown the VCS tree to buildd:buildd after fetching it, since
4 otherwise lpcraft running as the buildd user can't read its .git
5 directory.
6
7 -- Colin Watson <cjwatson@ubuntu.com> Thu, 26 Jan 2023 11:30:11 +0000
8
1launchpad-buildd (227) focal; urgency=medium9launchpad-buildd (227) focal; urgency=medium
210
3 * Tolerate receiving "builder_constraints": None.11 * Tolerate receiving "builder_constraints": None.
diff --git a/lpbuildd/target/run_ci.py b/lpbuildd/target/run_ci.py
index 62757e2..c0e8703 100644
--- a/lpbuildd/target/run_ci.py
+++ b/lpbuildd/target/run_ci.py
@@ -95,6 +95,7 @@ class RunCIPrepare(BuilderProxyOperationMixin, VCSOperationMixin,
95 env = self.build_proxy_environment(proxy_url=self.args.proxy_url)95 env = self.build_proxy_environment(proxy_url=self.args.proxy_url)
96 self.vcs_fetch("tree", cwd="/build", env=env)96 self.vcs_fetch("tree", cwd="/build", env=env)
97 self.vcs_update_status(self.buildd_path)97 self.vcs_update_status(self.buildd_path)
98 self.backend.run(["chown", "-R", "buildd:buildd", "/build/tree"])
9899
99 def run(self):100 def run(self):
100 try:101 try:
diff --git a/lpbuildd/target/tests/test_run_ci.py b/lpbuildd/target/tests/test_run_ci.py
index 3eac5fc..08c4d95 100644
--- a/lpbuildd/target/tests/test_run_ci.py
+++ b/lpbuildd/target/tests/test_run_ci.py
@@ -233,6 +233,7 @@ class TestRunCIPrepare(TestCase):
233 RanBuildCommand(233 RanBuildCommand(
234 ["git", "rev-parse", "HEAD^{}"],234 ["git", "rev-parse", "HEAD^{}"],
235 cwd="/build/tree", get_output=True, universal_newlines=True),235 cwd="/build/tree", get_output=True, universal_newlines=True),
236 RanCommand(["chown", "-R", "buildd:buildd", "/build/tree"]),
236 ]))237 ]))
237 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")238 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")
238 with open(status_path) as status:239 with open(status_path) as status:
@@ -259,6 +260,7 @@ class TestRunCIPrepare(TestCase):
259 RanBuildCommand(260 RanBuildCommand(
260 ["git", "rev-parse", "next^{}"],261 ["git", "rev-parse", "next^{}"],
261 cwd="/build/tree", get_output=True, universal_newlines=True),262 cwd="/build/tree", get_output=True, universal_newlines=True),
263 RanCommand(["chown", "-R", "buildd:buildd", "/build/tree"]),
262 ]))264 ]))
263 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")265 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")
264 with open(status_path) as status:266 with open(status_path) as status:
@@ -285,6 +287,7 @@ class TestRunCIPrepare(TestCase):
285 RanBuildCommand(287 RanBuildCommand(
286 ["git", "rev-parse", "refs/tags/1.0^{}"],288 ["git", "rev-parse", "refs/tags/1.0^{}"],
287 cwd="/build/tree", get_output=True, universal_newlines=True),289 cwd="/build/tree", get_output=True, universal_newlines=True),
290 RanCommand(["chown", "-R", "buildd:buildd", "/build/tree"]),
288 ]))291 ]))
289 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")292 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")
290 with open(status_path) as status:293 with open(status_path) as status:
@@ -318,6 +321,7 @@ class TestRunCIPrepare(TestCase):
318 RanBuildCommand(321 RanBuildCommand(
319 ["git", "rev-parse", "HEAD^{}"],322 ["git", "rev-parse", "HEAD^{}"],
320 cwd="/build/tree", get_output=True, universal_newlines=True),323 cwd="/build/tree", get_output=True, universal_newlines=True),
324 RanCommand(["chown", "-R", "buildd:buildd", "/build/tree"]),
321 ]))325 ]))
322 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")326 status_path = os.path.join(run_ci_prepare.backend.build_path, "status")
323 with open(status_path) as status:327 with open(status_path) as status:

Subscribers

People subscribed via source and target branches