← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~twom/launchpad-buildd/oci-dockerfile-location-fix into lp:launchpad-buildd

 

Tom Wardill has proposed merging lp:~twom/launchpad-buildd/oci-dockerfile-location-fix into lp:launchpad-buildd.

Commit message:
Dockerfile needs to be an absolute path

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad-buildd/oci-dockerfile-location-fix/+merge/381432

Passing the Dockerfile argument to the docker CLI requires an absolute path.
Join the path we have for the dockerfile with the build directory.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~twom/launchpad-buildd/oci-dockerfile-location-fix into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2020-03-18 14:51:35 +0000
+++ debian/changelog	2020-03-31 09:30:20 +0000
@@ -1,3 +1,10 @@
+launchpad-buildd (188) xenial; urgency=medium
+
+  [ Tom Wardill ]
+  * Fix Dockerfile location passing.
+
+  - Tom Wardill <tom.wardill@xxxxxxxxxxxxx>  Tue, 31 Mar 2020 10:19:03 +0000
+
 launchpad-buildd (187) xenial; urgency=medium
 
   [ Colin Watson ]

=== modified file 'lpbuildd/target/build_oci.py'
--- lpbuildd/target/build_oci.py	2020-02-26 10:52:29 +0000
+++ lpbuildd/target/build_oci.py	2020-03-31 09:30:20 +0000
@@ -99,6 +99,7 @@
 
     def build(self):
         logger.info("Running build phase...")
+        buildd_path = os.path.join("/home/buildd", self.args.name)
         args = ["docker", "build", "--no-cache"]
         if self.args.proxy_url:
             for var in ("http_proxy", "https_proxy"):
@@ -106,8 +107,8 @@
                     ["--build-arg", "{}={}".format(var, self.args.proxy_url)])
         args.extend(["--tag", self.args.name])
         if self.args.build_file is not None:
-            args.extend(["--file", self.args.build_file])
-        buildd_path = os.path.join("/home/buildd", self.args.name)
+            build_file_path = os.path.join(buildd_path, self.args.build_file)
+            args.extend(["--file", build_file_path])
         args.append(buildd_path)
         self.run_build_command(args)
 

=== modified file 'lpbuildd/target/tests/test_build_oci.py'
--- lpbuildd/target/tests/test_build_oci.py	2020-02-26 10:52:29 +0000
+++ lpbuildd/target/tests/test_build_oci.py	2020-03-31 09:30:20 +0000
@@ -312,7 +312,7 @@
         self.assertThat(build_oci.backend.run.calls, MatchesListwise([
             RanBuildCommand(
                 ["docker", "build", "--no-cache", "--tag", "test-image",
-                 "--file", "build-aux/Dockerfile",
+                 "--file", "/home/buildd/test-image/build-aux/Dockerfile",
                  "/home/buildd/test-image"]),
             ]))