Skip to content

Commit 88bdc51

Browse files
committed
Add an optional artifact-build moz.yaml key that passes --artifact to mach try. Fixes #410
1 parent d9f881d commit 88bdc51

6 files changed

Lines changed: 36 additions & 1 deletion

File tree

‎.github/gecko-test/libcubeb-preset/moz.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ updatebot:
3131
maintainer-bz: nobody@mozilla.com
3232
maintainer-phab: nobody
3333
try-preset: sm-shell
34+
artifact-build: true
3435
tasks:
3536
- type: vendoring
3637
enabled: True

‎apis/taskcluster.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ def submit_to_try(self, library, recursed=0):
183183
else:
184184
try_arguments = ["./mach", "try", "auto", "--push-to-vcs"]
185185

186+
if library.artifact_build:
187+
try_arguments.append("--artifact")
188+
186189
ret = self.run(try_arguments, clean_return=False)
187190
output = ret.stdout.decode()
188191
if ret.returncode:

‎components/libraryprovider.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __init__(self, dict):
5151
self.try_preset = dict.get('try_preset', None)
5252
self.fuzzy_query = dict.get('fuzzy_query', None)
5353
self.fuzzy_paths = dict.get('fuzzy_paths', None)
54+
self.artifact_build = dict.get('artifact_build', False)
5455
self.yaml_path = dict['yaml_path']
5556
# Paths are relative to the root of the gecko checkout, like yaml_path
5657
self.vendor_directory = dict.get('vendor_directory') or os.path.dirname(self.yaml_path)
@@ -91,6 +92,7 @@ def pretty_str(self):
9192
self.try_preset,
9293
self.fuzzy_query,
9394
self.fuzzy_paths,
95+
self.artifact_build,
9496
self.yaml_path)
9597
return "{{" + (" %s " * len(components) % components) + "}}"
9698

@@ -229,6 +231,7 @@ def validate_library(yaml_contents, yaml_path):
229231
'try_preset': '',
230232
'fuzzy_query': '',
231233
'fuzzy_paths': [],
234+
'artifact_build': False,
232235
'tasks': [],
233236
'yaml_path': '',
234237
'vendor_directory': '',
@@ -279,6 +282,7 @@ def validate_library(yaml_contents, yaml_path):
279282
validated_library['try_preset'] = get_or_none('updatebot', 'try-preset')
280283
validated_library['fuzzy_query'] = get_or_none('updatebot', 'fuzzy-query')
281284
validated_library['fuzzy_paths'] = get_or_none('updatebot', 'fuzzy-paths')
285+
validated_library['artifact_build'] = str(get_or_none('updatebot', 'artifact-build')).lower() == 'true'
282286

283287
if 'tasks' in library['updatebot']:
284288
for t in library['updatebot']['tasks']:

‎tests/functionality_all_platforms.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,13 +946,18 @@ def treeherder(request_type, fullpath):
946946
return "jobs_still_running.txt"
947947
return "jobs_classified_failures.txt"
948948

949+
def try_submit(cmd):
950+
self.assertTrue(cmd.endswith(" --preset sm-shell --artifact"), cmd)
951+
return TRY_OUTPUT(expected_values.try_revision_id(), False)
952+
949953
library_filter = 'cubeb-preset'
950954
(u, expected_values, _check_jobs) = self._setup(
951955
library_filter,
952956
lambda b: ["e152bb86666565ee6619c15f60156cd6c79580a9|2021-02-09 15:30:04 -0500|2021-02-12 17:40:01 +0000"],
953957
lambda: 50, # get_filed_bug_id_func,
954958
lambda b: {}, # filed_bug_ids_func
955-
treeherder
959+
treeherder,
960+
command_callbacks={'try_submit': try_submit}
956961
)
957962
try:
958963
# Run it

‎tests/library.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"maintainer_bz": "nobody@mozilla.com",
5151
"maintainer_phab": "nobody",
5252
"try_preset": "sm-shell",
53+
"artifact_build": True,
5354
"tasks": [
5455
LibraryProvider.validate_task({
5556
'type': "vendoring",
@@ -219,6 +220,26 @@ def manifest(vendoring_extra):
219220
self.assertEqual(lib.vendor_directory, "third_party/foo")
220221
self.assertEqual(lib.generated, [])
221222

223+
def testArtifactBuild(self):
224+
def artifact_build(updatebot_extra):
225+
return LibraryProvider.validate_library("""
226+
schema: 1
227+
bugzilla:
228+
product: Core
229+
component: "Audio/Video: Playback"
230+
origin:
231+
name: libfoo
232+
updatebot:
233+
maintainer-bz: foo
234+
maintainer-phab: bar
235+
try-preset: sm-shell
236+
%s""" % updatebot_extra, "fake/path").artifact_build
237+
238+
self.assertIs(artifact_build(" artifact-build: true"), True)
239+
self.assertIs(artifact_build(" artifact-build: True"), True)
240+
self.assertIs(artifact_build(" artifact-build: false"), False)
241+
self.assertIs(artifact_build(""), False)
242+
222243
def testLibraryExceptions(self):
223244
test_vectors = [
224245
("Blank", ""),

‎tests/mock_libraryprovider.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def get_libraries(self, gecko_path):
7171
"maintainer_phab": "nobody",
7272
"maintainer_bz": "nobody@mozilla.com",
7373
"try_preset": "sm-shell",
74+
"artifact_build": True,
7475
"revision": self.config.get('vendoring_revision_override', None),
7576
"repo_url": "https://example.invalid",
7677
"has_patches": False,

0 commit comments

Comments
 (0)