Merge ~ines-almeida/launchpad:fetch-service-add-missing-fetch-service-args into launchpad:master

Proposed by Ines Almeida
Status: Merged
Approved by: Ines Almeida
Approved revision: 42c46ed04c10a50bd7cf57b0ccf21df856fe2d7d
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ines-almeida/launchpad:fetch-service-add-missing-fetch-service-args
Merge into: launchpad:master
Diff against target: 205 lines (+27/-0)
6 files modified
lib/lp/buildmaster/builderproxy.py (+1/-0)
lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py (+2/-0)
lib/lp/charms/tests/test_charmrecipebuildbehaviour.py (+3/-0)
lib/lp/code/model/tests/test_cibuildbehaviour.py (+3/-0)
lib/lp/oci/tests/test_ocirecipebuildbehaviour.py (+5/-0)
lib/lp/snappy/tests/test_snapbuildbehaviour.py (+13/-0)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+465003@code.launchpad.net

Commit message

Add missing `use_fetch_service` arg when starting a build

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

It looks like that as a minimum we need to add the new arg to the `BuildArgs` class in buildfarmjobbehaviour.py.

Additionally, I would love to see an additional or updated test related to this code change.

Also, how did you notice the missing arg? This might be valuable information to avoid similar issues in the future, as we need to add new build types in the next cycle.

Revision history for this message
Ines Almeida (ines-almeida) wrote (last edit ):

Updated (still squashed into 1 commit since it was just a 1-liner)

This was a very quick MP that I opened right before the EOD to get it out of the way, it isn't blocking any testing as I cowboyed it in qastaging.

As for noticing the missing arg: I simply noticed some code wasn't running in buildd, and I checked the build logs to find that this expected arg wasn't there. Adding it fixed the initial issue.

Revision history for this message
Jürgen Gmach (jugmac00) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/buildmaster/builderproxy.py b/lib/lp/buildmaster/builderproxy.py
2index 9bacf76..1fc0d9b 100644
3--- a/lib/lp/buildmaster/builderproxy.py
4+++ b/lib/lp/buildmaster/builderproxy.py
5@@ -98,6 +98,7 @@ class BuilderProxyMixin:
6
7 args["proxy_url"] = session_data["proxy_url"]
8 args["revocation_endpoint"] = session_data["revocation_endpoint"]
9+ args["use_fetch_service"] = use_fetch_service
10
11 @defer.inlineCallbacks
12 def endProxySession(self, upload_path: str):
13diff --git a/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py b/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py
14index 6a808b3..3c8a792 100644
15--- a/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py
16+++ b/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py
17@@ -142,6 +142,8 @@ class BuildArgs(TypedDict, total=False):
18 # A list of base64-encoded public keys for apt archives used by this
19 # build.
20 trusted_keys: List[str]
21+ # Is true, use the fetch service as the proxy within the builder.
22+ use_fetch_service: bool
23
24
25 class IBuildFarmJobBehaviour(Interface):
26diff --git a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
27index 07eb6e8..aaff515 100644
28--- a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
29+++ b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
30@@ -315,6 +315,7 @@ class TestAsyncCharmRecipeBuildBehaviour(
31 ),
32 "series": Equals("unstable"),
33 "trusted_keys": Equals(expected_trusted_keys),
34+ "use_fetch_service": Is(False),
35 }
36 ),
37 )
38@@ -356,6 +357,7 @@ class TestAsyncCharmRecipeBuildBehaviour(
39 ),
40 "series": Equals("unstable"),
41 "trusted_keys": Equals(expected_trusted_keys),
42+ "use_fetch_service": Is(False),
43 }
44 ),
45 )
46@@ -468,6 +470,7 @@ class TestAsyncCharmRecipeBuildBehaviour(
47 self.assertThat(
48 build_request[4]["proxy_url"], ProxyURLMatcher(job, self.now)
49 )
50+ self.assertFalse(build_request[4]["use_fetch_service"])
51
52 @defer.inlineCallbacks
53 def test_composeBuildRequest_git_ref_deleted(self):
54diff --git a/lib/lp/code/model/tests/test_cibuildbehaviour.py b/lib/lp/code/model/tests/test_cibuildbehaviour.py
55index 727f75a..d0c2beb 100644
56--- a/lib/lp/code/model/tests/test_cibuildbehaviour.py
57+++ b/lib/lp/code/model/tests/test_cibuildbehaviour.py
58@@ -311,6 +311,7 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
59 ),
60 "series": Equals(job.build.distro_series.name),
61 "trusted_keys": Equals(expected_trusted_keys),
62+ "use_fetch_service": Is(False),
63 }
64 ),
65 )
66@@ -467,6 +468,7 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
67 }
68 ),
69 "secrets": Equals({"soss_read_auth": "user:pass"}),
70+ "use_fetch_service": Is(False),
71 }
72 ),
73 )
74@@ -648,6 +650,7 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
75 ),
76 "series": Equals(job.build.distro_series.name),
77 "trusted_keys": Equals(expected_trusted_keys),
78+ "use_fetch_service": Is(False),
79 }
80 ),
81 )
82diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
83index e0bd58e..6d74c78 100644
84--- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
85+++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
86@@ -227,6 +227,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
87 self.assertEqual([], self.proxy_api.tokens.requests)
88 self.assertNotIn("proxy_url", args)
89 self.assertNotIn("revocation_endpoint", args)
90+ self.assertNotIn("use_fetch_service", args)
91
92 @defer.inlineCallbacks
93 def test_requestProxyToken_no_secret(self):
94@@ -520,6 +521,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
95 ),
96 }
97 ),
98+ "use_fetch_service": Is(False),
99 }
100 ),
101 )
102@@ -623,6 +625,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
103 ),
104 }
105 ),
106+ "use_fetch_service": Is(False),
107 }
108 ),
109 )
110@@ -683,6 +686,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
111 ),
112 }
113 ),
114+ "use_fetch_service": Is(False),
115 }
116 ),
117 )
118@@ -867,6 +871,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
119 args = yield job.extraBuildArgs()
120 self.assertNotIn("proxy_url", args)
121 self.assertNotIn("revocation_endpoint", args)
122+ self.assertNotIn("use_fetch_service", args)
123
124
125 class TestHandleStatusForOCIRecipeBuild(
126diff --git a/lib/lp/snappy/tests/test_snapbuildbehaviour.py b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
127index d48efbc..81d6926 100644
128--- a/lib/lp/snappy/tests/test_snapbuildbehaviour.py
129+++ b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
130@@ -399,6 +399,7 @@ class TestAsyncSnapBuildBehaviourFetchService(
131 )
132 self.assertIn("proxy_url", args)
133 self.assertIn("revocation_endpoint", args)
134+ self.assertTrue(args["use_fetch_service"])
135 self.assertIn("secrets", args)
136 self.assertIn("fetch_service_mitm_certificate", args["secrets"])
137 self.assertIn(
138@@ -575,6 +576,7 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
139 self.assertEqual([], self.proxy_api.tokens.requests)
140 self.assertNotIn("proxy_url", args)
141 self.assertNotIn("revocation_endpoint", args)
142+ self.assertNotIn("use_fetch_service", args)
143
144 @defer.inlineCallbacks
145 def test_requestProxyToken_no_secret(self):
146@@ -660,6 +662,11 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
147 self.assertIn("universe", archive_line)
148 with dbuser(config.builddmaster.dbuser):
149 args = yield job.extraBuildArgs()
150+
151+ # XXX ines-almeida 2024-04-26: use_fetch_service is `None` because we
152+ # are not setting the fetch-service feature flag 'ON' for these tests
153+ # (since that's not the point of these test). Once we remove the
154+ # feature flag, this will either be True or False - not None.
155 self.assertThat(
156 args,
157 MatchesDict(
158@@ -681,6 +688,7 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
159 "series": Equals("unstable"),
160 "trusted_keys": Equals(expected_trusted_keys),
161 "target_architectures": Equals(["i386"]),
162+ "use_fetch_service": Is(None),
163 }
164 ),
165 )
166@@ -734,6 +742,7 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
167 "series": Equals("unstable"),
168 "trusted_keys": Equals(expected_trusted_keys),
169 "target_architectures": Equals(["i386"]),
170+ "use_fetch_service": Is(None),
171 }
172 ),
173 )
174@@ -776,6 +785,7 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
175 "series": Equals("unstable"),
176 "trusted_keys": Equals(expected_trusted_keys),
177 "target_architectures": Equals(["i386"]),
178+ "use_fetch_service": Is(None),
179 }
180 ),
181 )
182@@ -849,6 +859,7 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
183 "series": Equals("unstable"),
184 "trusted_keys": Equals(expected_trusted_keys),
185 "target_architectures": Equals(["i386"]),
186+ "use_fetch_service": Is(None),
187 }
188 ),
189 )
190@@ -894,6 +905,7 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
191 "series": Equals("unstable"),
192 "trusted_keys": Equals(expected_trusted_keys),
193 "target_architectures": Equals(["i386"]),
194+ "use_fetch_service": Is(None),
195 }
196 ),
197 )
198@@ -936,6 +948,7 @@ class TestAsyncSnapBuildBehaviourBuilderProxy(
199 "series": Equals("unstable"),
200 "trusted_keys": Equals(expected_trusted_keys),
201 "target_architectures": Equals(["i386"]),
202+ "use_fetch_service": Is(None),
203 }
204 ),
205 )

Subscribers

People subscribed via source and target branches

to status/vote changes: