author | Dustin J. Mitchell <dustin@mozilla.com> |
Tue, 30 Apr 2019 13:48:05 +0000 | |
changeset 535878 | 80a1bc138c4f8c3b78778960769a1b4d3a3feee5 |
parent 535877 | b64e1b70da6cd03af4bb11c394371fece743f108 |
child 535879 | 1fb59fab2d6bccfaa73021ffc7169598e04a5aec |
push id | 2082 |
push user | ffxbld-merge |
push date | Mon, 01 Jul 2019 08:34:18 +0000 |
treeherder | mozilla-release@2fb19d0466d2 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Callek |
bugs | 1547781 |
milestone | 68.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -40,16 +40,17 @@ # push: {owner, pushlog_id, revision}, # repository: {url, project, level}, # input, # parameters, # taskId, // targetted taskId # taskGroupId, // targetted taskGroupId # action: {name, title, description, taskGroupId, symbol, repo_scope, cb_name} # ownTaskId: // taskId of the task that will be created +# clientId: // clientId that triggered this hook # } version: 1 tasks: # NOTE: support for actions in ci-admin requires that the `tasks` property be an array *before* JSON-e rendering # takes place. - $if: 'tasks_for in ["hg-push", "action", "cron"]' then:
--- a/taskcluster/taskgraph/test/python.ini +++ b/taskcluster/taskgraph/test/python.ini @@ -9,16 +9,17 @@ skip-if = python == 3 [test_files_changed.py] [test_generator.py] [test_graph.py] [test_morph.py] [test_optimize.py] [test_parameters.py] [test_target_tasks.py] [test_taskgraph.py] +[test_taskcluster_yml.py] [test_transforms_base.py] [test_transforms_job.py] [test_try_option_syntax.py] [test_util_attributes.py] [test_util_docker.py] [test_util_parameterization.py] [test_util_python_path.py] [test_util_runnable_jobs.py]
new file mode 100644 --- /dev/null +++ b/taskcluster/taskgraph/test/test_taskcluster_yml.py @@ -0,0 +1,118 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from __future__ import absolute_import, unicode_literals + +import jsone +import pprint +import slugid +import unittest + +from mozunit import main + +from taskgraph.util.yaml import load_yaml +from taskgraph.util.time import current_json_time +from taskgraph import GECKO + + +class TestTaskclusterYml(unittest.TestCase): + + taskcluster_yml = load_yaml(GECKO, ".taskcluster.yml") + + def test_push(self): + context = { + "tasks_for": "hg-push", + "push": { + "revision": "e8d2d9aff5026ef1f1777b781b47fdcbdb9d8f20", + "owner": "dustin@mozilla.com", + "pushlog_id": 1556565286, + "pushdate": 112957, + }, + "repository": { + "url": "https://hg.mozilla.org/mozilla-central", + "project": "mozilla-central", + "level": "3", + }, + "ownTaskId": slugid.nice().encode("ascii"), + } + rendered = jsone.render(self.taskcluster_yml, context) + pprint.pprint(rendered) + self.assertEqual( + rendered["tasks"][0]["metadata"]["name"], "Gecko Decision Task" + ) + + def test_cron(self): + context = { + "tasks_for": "cron", + "repository": { + "url": "https://hg.mozilla.org/mozilla-central", + "project": "mozilla-central", + "level": 3, + }, + "push": { + "revision": "e8aebe488b2f2e567940577de25013d00e818f7c", + "pushlog_id": -1, + "pushdate": 0, + "owner": "cron", + }, + "cron": { + "task_id": "<cron task id>", + "job_name": "test", + "job_symbol": "T", + "quoted_args": "abc def", + }, + "now": current_json_time(), + "ownTaskId": slugid.nice().encode("ascii"), + } + rendered = jsone.render(self.taskcluster_yml, context) + pprint.pprint(rendered) + self.assertEqual( + rendered["tasks"][0]["metadata"]["name"], "Decision Task for cron job test" + ) + + def test_action(self): + context = { + "tasks_for": "action", + "repository": { + "url": "https://hg.mozilla.org/mozilla-central", + "project": "mozilla-central", + "level": 3, + }, + "push": { + "revision": "e8d2d9aff5026ef1f1777b781b47fdcbdb9d8f20", + "owner": "dustin@mozilla.com", + "pushlog_id": 1556565286, + "pushdate": 112957, + }, + "action": { + "name": "test-action", + "title": "Test Action", + "description": "Just testing", + "taskGroupId": slugid.nice().encode("ascii"), + "symbol": "t", + "repo_scope": "assume:repo:hg.mozilla.org/try:action:generic", + "cb_name": "test_action", + }, + "input": {}, + "parameters": {}, + "now": current_json_time(), + "taskId": slugid.nice().encode("ascii"), + "ownTaskId": slugid.nice().encode("ascii"), + "clientId": "testing/testing/testing", + } + rendered = jsone.render(self.taskcluster_yml, context) + pprint.pprint(rendered) + self.assertEqual( + rendered["tasks"][0]["metadata"]["name"], "Action: Test Action" + ) + + def test_unknown(self): + context = {"tasks_for": "bitkeeper-push"} + rendered = jsone.render(self.taskcluster_yml, context) + pprint.pprint(rendered) + self.assertEqual(rendered["tasks"], []) + + +if __name__ == "__main__": + main()