Bug 1797325: Support try presets in moz.yaml r=andi

Differential Revision: https://phabricator.services.mozilla.com/D160232
This commit is contained in:
Tom Ritter
2022-11-01 14:13:42 +00:00
parent c46f7e1cde
commit 98be2e7ddd
2 changed files with 87 additions and 4 deletions

View File

@@ -161,6 +161,46 @@ bugzilla:
product: Core
component: Graphics
updatebot:
maintainer-phab: tjr
maintainer-bz: a@example.com
""".strip(),
),
# -------------------------------------------------
(
{
"schema": "1",
"origin": {
"description": "2D Graphics Library",
"license": ["MPL-1.1", "LGPL-2.1"],
"name": "cairo",
"release": "version 1.6.4",
"revision": "001122334455",
"url": "https://www.cairographics.org/",
},
"bugzilla": {"component": "Graphics", "product": "Core"},
"updatebot": {
"try-preset": "foo",
"maintainer-phab": "tjr",
"maintainer-bz": "a@example.com",
},
},
b"""
---
schema: 1
origin:
name: cairo
description: 2D Graphics Library
url: https://www.cairographics.org/
release: version 1.6.4
license:
- MPL-1.1
- LGPL-2.1
revision: 001122334455
bugzilla:
product: Core
component: Graphics
updatebot:
try-preset: foo
maintainer-phab: tjr
maintainer-bz: a@example.com
""".strip(),
@@ -208,6 +248,36 @@ bugzilla:
product: Core
component: Graphics
updatebot:
fuzzy-query: "!linux64"
maintainer-phab: tjr
maintainer-bz: a@example.com
tasks:
- type: commit-alert
""".strip(),
),
# -------------------------------------------------
(
"exception",
b"""
---
schema: 1
origin:
name: cairo
description: 2D Graphics Library
url: https://www.cairographics.org/
release: version 1.6.4
license:
- MPL-1.1
- LGPL-2.1
revision: AA001122334455
vendoring:
url: https://example.com
source-hosting: gitlab
bugzilla:
product: Core
component: Graphics
updatebot:
try-preset: foo
fuzzy-query: "!linux64"
maintainer-phab: tjr
maintainer-bz: a@example.com

View File

@@ -284,12 +284,16 @@ updatebot:
# Bugzilla email address for a maintainer of the library, used for needinfos
maintainer-bz: tom@mozilla.com
# Optional: A query string for ./mach try fuzzy. If it and fuzzy-paths are omitted then
# ./mach try auto will be used
# Optional: A preset for ./mach try to use. If present, fuzzy-query and fuzzy-paths will
# be ignored. If it, fuzzy-query, and fuzzy-path are omitted, ./mach try auto will be used
try-preset: media
# Optional: A query string for ./mach try fuzzy. If try-preset, it and fuzzy-paths are omitted
# then ./mach try auto will be used
fuzzy-query: media
# Optional: An array of test paths for ./mach try fuzzy. If it and fuzzy-query are omitted then
# ./mach try auto will be used
# Optional: An array of test paths for ./mach try fuzzy. If try-preset, it and fuzzy-query are
# omitted then ./mach try auto will be used
fuzzy-paths: ['media']
# The tasks that Updatebot can run. Only one of each task is currently permitted
@@ -389,6 +393,7 @@ def _schema_1():
"updatebot": {
Required("maintainer-phab"): All(str, Length(min=1)),
Required("maintainer-bz"): All(str, Length(min=1)),
"try-preset": All(str, Length(min=1)),
"fuzzy-query": All(str, Length(min=1)),
"fuzzy-paths": All([str], Length(min=1)),
"tasks": All(
@@ -571,6 +576,14 @@ def _schema_1_additional(filename, manifest, require_license_file=True):
"The individual-files flavor of update must include 'individual-files'"
)
if "updatebot" in manifest:
if "try-preset" in manifest["updatebot"]:
for f in ["fuzzy-query", "fuzzy-paths"]:
if f in manifest["updatebot"]:
raise ValueError(
"If 'try-preset' is specified, then %s cannot be" % f
)
# Check for a simple YAML file
with open(filename, "r") as f:
has_schema = False