launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23591
[Merge] lp:~matiasb/launchpad/snap-build-request-extra-args into lp:launchpad
Matias Bordese has proposed merging lp:~matiasb/launchpad/snap-build-request-extra-args into lp:launchpad.
Commit message:
Added build request data to extra args for snap builds.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~matiasb/launchpad/snap-build-request-extra-args/+merge/366594
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~matiasb/launchpad/snap-build-request-extra-args into lp:launchpad.
=== modified file 'lib/lp/snappy/model/snapbuildbehaviour.py'
--- lib/lp/snappy/model/snapbuildbehaviour.py 2019-03-06 23:00:49 +0000
+++ lib/lp/snappy/model/snapbuildbehaviour.py 2019-04-30 12:55:54 +0000
@@ -142,6 +142,14 @@
(build.snap.owner.name, build.snap.name))
args["build_source_tarball"] = build.snap.build_source_tarball
args["private"] = build.is_private
+ build_request = build.build_request
+ if build_request is not None:
+ # RFC3339 format for timestamp
+ # (matching snapd, SAS and snapcraft representation)
+ timestamp = build_request.date_requested.replace(
+ microsecond=0, tzinfo=None).isoformat() + 'Z'
+ args["build_request_id"] = build_request.id
+ args["build_request_timestamp"] = timestamp
defer.returnValue(args)
@defer.inlineCallbacks
=== modified file 'lib/lp/snappy/tests/test_snapbuildbehaviour.py'
--- lib/lp/snappy/tests/test_snapbuildbehaviour.py 2019-03-06 22:27:11 +0000
+++ lib/lp/snappy/tests/test_snapbuildbehaviour.py 2019-04-30 12:55:54 +0000
@@ -405,6 +405,17 @@
}))
@defer.inlineCallbacks
+ def test_extraBuildArgs_build_request_args(self):
+ snap = self.factory.makeSnap()
+ request = self.factory.makeSnapBuildRequest(snap=snap)
+ job = self.makeJob(snap=snap, build_request=request)
+ args = yield job.extraBuildArgs()
+ self.assertEqual(request.id, args["build_request_id"])
+ expected_timestamp = request.date_requested.replace(
+ microsecond=0, tzinfo=None).isoformat() + 'Z'
+ self.assertEqual(expected_timestamp, args["build_request_timestamp"])
+
+ @defer.inlineCallbacks
def test_extraBuildArgs_git(self):
# extraBuildArgs returns appropriate arguments if asked to build a
# job for a Git branch.
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2019-02-07 15:04:13 +0000
+++ lib/lp/testing/factory.py 2019-04-30 12:55:54 +0000
@@ -4769,7 +4769,7 @@
def makeSnapBuild(self, requester=None, registrant=None, snap=None,
archive=None, distroarchseries=None, pocket=None,
- channels=None, date_created=DEFAULT,
+ channels=None, date_created=DEFAULT, build_request=None,
status=BuildStatus.NEEDSBUILD, builder=None,
duration=None, **kwargs):
"""Make a new SnapBuild."""
@@ -4799,7 +4799,8 @@
pocket = PackagePublishingPocket.UPDATES
snapbuild = getUtility(ISnapBuildSet).new(
requester, snap, archive, distroarchseries, pocket,
- channels=channels, date_created=date_created)
+ channels=channels, date_created=date_created,
+ build_request=build_request)
if duration is not None:
removeSecurityProxy(snapbuild).updateStatus(
BuildStatus.BUILDING, builder=builder,
Follow ups