Bug 1703066 - add tracking key to mozyaml file schema; r=tjr

Differential Revision: https://phabricator.services.mozilla.com/D110829
This commit is contained in:
june wilde 2021-06-29 14:01:58 +00:00
Родитель 3443c47a26
Коммит 68adbeeae5
2 изменённых файлов: 30 добавлений и 38 удалений

Просмотреть файл

@ -41,10 +41,7 @@ class TestManifest(unittest.TestCase):
"revision": "AA001122334455", "revision": "AA001122334455",
"url": "https://www.cairographics.org/", "url": "https://www.cairographics.org/",
}, },
"bugzilla": { "bugzilla": {"component": "Graphics", "product": "Core"},
"component": "Graphics",
"product": "Core",
},
} }
self.process_test_vectors( self.process_test_vectors(
@ -104,10 +101,7 @@ bugzilla:
"revision": "AA001122334455", "revision": "AA001122334455",
"url": "https://www.cairographics.org/", "url": "https://www.cairographics.org/",
}, },
"bugzilla": { "bugzilla": {"component": "Graphics", "product": "Core"},
"component": "Graphics",
"product": "Core",
},
"updatebot": { "updatebot": {
"maintainer-phab": "tjr", "maintainer-phab": "tjr",
"maintainer-bz": "a@example.com", "maintainer-bz": "a@example.com",
@ -145,10 +139,7 @@ updatebot:
"revision": "AA001122334455", "revision": "AA001122334455",
"url": "https://www.cairographics.org/", "url": "https://www.cairographics.org/",
}, },
"bugzilla": { "bugzilla": {"component": "Graphics", "product": "Core"},
"component": "Graphics",
"product": "Core",
},
"vendoring": { "vendoring": {
"url": "https://example.com", "url": "https://example.com",
"source-hosting": "gitlab", "source-hosting": "gitlab",
@ -156,6 +147,7 @@ updatebot:
"updatebot": { "updatebot": {
"maintainer-phab": "tjr", "maintainer-phab": "tjr",
"maintainer-bz": "a@example.com", "maintainer-bz": "a@example.com",
"tracking": "commit",
"tasks": [{"type": "commit-alert"}], "tasks": [{"type": "commit-alert"}],
}, },
}, },
@ -196,10 +188,7 @@ updatebot:
"revision": "AA001122334455", "revision": "AA001122334455",
"url": "https://www.cairographics.org/", "url": "https://www.cairographics.org/",
}, },
"bugzilla": { "bugzilla": {"component": "Graphics", "product": "Core"},
"component": "Graphics",
"product": "Core",
},
"vendoring": { "vendoring": {
"url": "https://example.com", "url": "https://example.com",
"source-hosting": "gitlab", "source-hosting": "gitlab",
@ -207,11 +196,9 @@ updatebot:
"updatebot": { "updatebot": {
"maintainer-phab": "tjr", "maintainer-phab": "tjr",
"maintainer-bz": "a@example.com", "maintainer-bz": "a@example.com",
"tracking": "commit",
"tasks": [ "tasks": [
{ {"type": "commit-alert", "frequency": "release"},
"type": "commit-alert",
"frequency": "release",
},
{ {
"type": "vendoring", "type": "vendoring",
"branch": "foo", "branch": "foo",
@ -244,6 +231,7 @@ bugzilla:
updatebot: updatebot:
maintainer-phab: tjr maintainer-phab: tjr
maintainer-bz: a@example.com maintainer-bz: a@example.com
tracking: commit
tasks: tasks:
- type: commit-alert - type: commit-alert
frequency: release frequency: release
@ -267,10 +255,7 @@ updatebot:
"revision": "AA001122334455", "revision": "AA001122334455",
"url": "https://www.cairographics.org/", "url": "https://www.cairographics.org/",
}, },
"bugzilla": { "bugzilla": {"component": "Graphics", "product": "Core"},
"component": "Graphics",
"product": "Core",
},
"vendoring": { "vendoring": {
"url": "https://example.com", "url": "https://example.com",
"source-hosting": "gitlab", "source-hosting": "gitlab",
@ -278,6 +263,7 @@ updatebot:
"updatebot": { "updatebot": {
"maintainer-phab": "tjr", "maintainer-phab": "tjr",
"maintainer-bz": "a@example.com", "maintainer-bz": "a@example.com",
"tracking": "commit",
"tasks": [ "tasks": [
{ {
"type": "vendoring", "type": "vendoring",
@ -746,10 +732,7 @@ updatebot:
"revision": "v1.6.37", "revision": "v1.6.37",
"url": "https://www.cairographics.org/", "url": "https://www.cairographics.org/",
}, },
"bugzilla": { "bugzilla": {"component": "Graphics", "product": "Core"},
"component": "Graphics",
"product": "Core",
},
}, },
b""" b"""
--- ---

29
python/mozbuild/mozbuild/vendor/moz_yaml.py поставляемый
Просмотреть файл

@ -121,6 +121,10 @@ updatebot:
# Bugzilla email address for a maintainer of the library, used for needinfos # Bugzilla email address for a maintainer of the library, used for needinfos
maintainer-bz: tom@mozilla.com maintainer-bz: tom@mozilla.com
# Type of git reference (commit, tag) to track updates from.
# If omitted, will default to tracking commits.
tracking: commit
# The tasks that Updatebot can run. Only one of each task is currently permitted # The tasks that Updatebot can run. Only one of each task is currently permitted
# optional # optional
tasks: tasks:
@ -361,15 +365,13 @@ def _schema_1():
"updatebot": { "updatebot": {
Required("maintainer-phab"): All(str, Length(min=1)), Required("maintainer-phab"): All(str, Length(min=1)),
Required("maintainer-bz"): All(str, Length(min=1)), Required("maintainer-bz"): All(str, Length(min=1)),
"tracking": All(str, Length(min=1)),
"tasks": All( "tasks": All(
UpdatebotTasks(), UpdatebotTasks(),
[ [
{ {
Required("type"): In( Required("type"): In(
[ ["vendoring", "commit-alert"],
"vendoring",
"commit-alert",
],
msg="Invalid type specified in tasks", msg="Invalid type specified in tasks",
), ),
"branch": All(str, Length(min=1)), "branch": All(str, Length(min=1)),
@ -377,11 +379,7 @@ def _schema_1():
"cc": Unique([str]), "cc": Unique([str]),
"needinfo": Unique([str]), "needinfo": Unique([str]),
"filter": In( "filter": In(
[ ["none", "security", "source-extensions"],
"none",
"security",
"source-extensions",
],
msg="Invalid filter value specified in tasks", msg="Invalid filter value specified in tasks",
), ),
"source-extensions": Unique([str]), "source-extensions": Unique([str]),
@ -460,8 +458,19 @@ def _schema_1_additional(filename, manifest, require_license_file=True):
if "vendoring" in manifest and "origin" not in manifest: if "vendoring" in manifest and "origin" not in manifest:
raise ValueError('"vendoring" requires an "origin"') raise ValueError('"vendoring" requires an "origin"')
# If there are Updatebot tasks, then certain fields must be present # If there are Updatebot tasks, then certain fields must be present and
# defaults need to be set.
if "updatebot" in manifest and "tasks" in manifest["updatebot"]: if "updatebot" in manifest and "tasks" in manifest["updatebot"]:
if "tracking" not in manifest["updatebot"]:
manifest["updatebot"]["tracking"] = "commit"
if (
manifest["updatebot"]["tracking"] != "commit"
and manifest["updatebot"]["tracking"] != "tag"
):
raise ValueError(
"Only commit or tag is supported for git references to track, %s was given."
% manifest["updatebot"]["tracking"]
)
if "vendoring" not in manifest or "url" not in manifest["vendoring"]: if "vendoring" not in manifest or "url" not in manifest["vendoring"]:
raise ValueError( raise ValueError(
"If Updatebot tasks are specified, a vendoring url must be included." "If Updatebot tasks are specified, a vendoring url must be included."