mozilla-taskgraph 1.2.2__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mozilla-taskgraph-1.2.2/src/mozilla_taskgraph.egg-info → mozilla-taskgraph-1.3.0}/PKG-INFO +2 -1
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/__init__.py +10 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/actions/release_promotion.py +20 -5
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/version.py +1 -3
- mozilla-taskgraph-1.3.0/src/mozilla_taskgraph/worker_types.py +117 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0/src/mozilla_taskgraph.egg-info}/PKG-INFO +2 -1
- mozilla-taskgraph-1.3.0/test/test_worker_types.py +111 -0
- mozilla-taskgraph-1.2.2/src/mozilla_taskgraph/worker_types.py +0 -14
- mozilla-taskgraph-1.2.2/test/test_worker_types.py +0 -11
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/LICENSE +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/README.md +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/pyproject.toml +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/setup.cfg +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/setup.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/actions/__init__.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/config.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/transforms/__init__.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/transforms/scriptworker/__init__.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/transforms/scriptworker/release_artifacts.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/transforms/scriptworker/shipit/__init__.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/transforms/scriptworker/shipit/mark_as_shipped.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph.egg-info/SOURCES.txt +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph.egg-info/dependency_links.txt +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph.egg-info/requires.txt +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph.egg-info/top_level.txt +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/test/test_register.py +0 -0
- {mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/test/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mozilla-taskgraph
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Mozilla-specific transforms and utilities for Taskgraph
|
|
5
5
|
Home-page: https://github.com/mozilla-releng/mozilla-taskgraph
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -12,3 +12,4 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Topic :: Software Development
|
|
14
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: taskcluster-taskgraph<8,>=5.4
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
from importlib import import_module
|
|
6
6
|
|
|
7
7
|
from taskgraph.config import validate_graph_config
|
|
8
|
+
from taskgraph.util import schema
|
|
9
|
+
|
|
10
|
+
# Schemas for YAML files should use dashed identifiers by default. If there are
|
|
11
|
+
# components of the schema for which there is a good reason to use another format,
|
|
12
|
+
# exceptions can be added here.
|
|
13
|
+
schema.EXCEPTED_SCHEMA_IDENTIFIERS.extend(
|
|
14
|
+
[
|
|
15
|
+
"bitrise",
|
|
16
|
+
]
|
|
17
|
+
)
|
|
8
18
|
|
|
9
19
|
|
|
10
20
|
def register(graph_config):
|
|
@@ -39,6 +39,17 @@ from mozilla_taskgraph.actions import make_action_available
|
|
|
39
39
|
"release version, and increments on rebuild."
|
|
40
40
|
),
|
|
41
41
|
},
|
|
42
|
+
"version": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": (
|
|
45
|
+
"Optional: override the version for release promotion. "
|
|
46
|
+
"Occasionally we'll land a taskgraph fix in a later "
|
|
47
|
+
"commit, but want to act on a build from a previous "
|
|
48
|
+
"commit. If a version bump has landed in the meantime, "
|
|
49
|
+
"relying on the in-tree version will break things."
|
|
50
|
+
),
|
|
51
|
+
"default": "",
|
|
52
|
+
},
|
|
42
53
|
"do_not_optimize": {
|
|
43
54
|
"type": "array",
|
|
44
55
|
"description": (
|
|
@@ -127,11 +138,15 @@ def release_promotion_action(parameters, graph_config, input, task_group_id, tas
|
|
|
127
138
|
parameters["shipping_phase"] = input["release_promotion_flavor"]
|
|
128
139
|
parameters["tasks_for"] = "action"
|
|
129
140
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
141
|
+
if input["version"]:
|
|
142
|
+
parameters["version"] = input["version"]
|
|
143
|
+
else:
|
|
144
|
+
if "version-parser" in graph_config:
|
|
145
|
+
version_parser_objpath = graph_config["version-parser"]
|
|
146
|
+
else:
|
|
147
|
+
version_parser_objpath = "mozilla_taskgraph.version:default_parser"
|
|
148
|
+
version_func = find_object(version_parser_objpath)
|
|
149
|
+
parameters["version"] = version_func(parameters)
|
|
135
150
|
|
|
136
151
|
# make parameters read-only
|
|
137
152
|
parameters = Parameters(**parameters)
|
|
@@ -2,11 +2,9 @@ import os
|
|
|
2
2
|
|
|
3
3
|
from taskgraph.util.vcs import get_repository
|
|
4
4
|
|
|
5
|
-
here = os.path.abspath(os.path.dirname(__file__))
|
|
6
|
-
|
|
7
5
|
|
|
8
6
|
def default_parser(params):
|
|
9
|
-
repo_root = get_repository(
|
|
7
|
+
repo_root = get_repository(os.getcwd()).path
|
|
10
8
|
|
|
11
9
|
with open(os.path.join(repo_root, "version.txt")) as f:
|
|
12
10
|
return f.read().strip()
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
from taskgraph.transforms.task import payload_builder
|
|
2
|
+
from voluptuous import Extra, Optional, Required
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@payload_builder(
|
|
6
|
+
"scriptworker-bitrise",
|
|
7
|
+
schema={
|
|
8
|
+
Required("bitrise"): {
|
|
9
|
+
Required(
|
|
10
|
+
"app", description="Name of Bitrise App to schedule workflows on."
|
|
11
|
+
): str,
|
|
12
|
+
Required(
|
|
13
|
+
"workflows",
|
|
14
|
+
description="List of workflows to trigger on specified app.",
|
|
15
|
+
): [str],
|
|
16
|
+
Optional(
|
|
17
|
+
"build_params",
|
|
18
|
+
description="Parameters describing the build context to pass "
|
|
19
|
+
"onto Bitrise. All keys are optional but specific workflows "
|
|
20
|
+
"may depend on particular keys being set.",
|
|
21
|
+
): {
|
|
22
|
+
Optional(
|
|
23
|
+
"branch",
|
|
24
|
+
description="The branch running the build. For pull "
|
|
25
|
+
"requests, this should be the head branch.",
|
|
26
|
+
): str,
|
|
27
|
+
Optional(
|
|
28
|
+
"branch_dest",
|
|
29
|
+
description="The destination branch where the branch "
|
|
30
|
+
"running the build will merge into. Only valid for pull "
|
|
31
|
+
"requests.",
|
|
32
|
+
): str,
|
|
33
|
+
Optional(
|
|
34
|
+
"branch_dest_repo_owner",
|
|
35
|
+
description="The repository owning the destination branch. "
|
|
36
|
+
"Only valid for pull requests.",
|
|
37
|
+
): str,
|
|
38
|
+
Optional(
|
|
39
|
+
"branch_repo_owner", description="The repository owning the branch."
|
|
40
|
+
): str,
|
|
41
|
+
Optional(
|
|
42
|
+
"commit_hash",
|
|
43
|
+
description="The hash of the commit running the build.",
|
|
44
|
+
): str,
|
|
45
|
+
Optional(
|
|
46
|
+
"commit_message",
|
|
47
|
+
description="The commit message of the commit running the build.",
|
|
48
|
+
): str,
|
|
49
|
+
Optional(
|
|
50
|
+
"environments",
|
|
51
|
+
description="Environment variables to pass into the build.",
|
|
52
|
+
): dict,
|
|
53
|
+
Optional(
|
|
54
|
+
"pull_request_author",
|
|
55
|
+
description="The author of the pull request running the build.",
|
|
56
|
+
): str,
|
|
57
|
+
Optional(
|
|
58
|
+
"pull_request_id",
|
|
59
|
+
description="The id of the pull request running the build.",
|
|
60
|
+
): int,
|
|
61
|
+
Optional(
|
|
62
|
+
"skip_git_status_report",
|
|
63
|
+
description="Whether Bitrise should send a status report to "
|
|
64
|
+
"Github (default False).",
|
|
65
|
+
): bool,
|
|
66
|
+
Optional(
|
|
67
|
+
"tag", description="The tag of the commit running the build."
|
|
68
|
+
): str,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
Extra: object,
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
def build_bitrise_payload(config, task, task_def):
|
|
75
|
+
bitrise = task["worker"]["bitrise"]
|
|
76
|
+
build_params = task_def["payload"] = bitrise.get("build_params") or {}
|
|
77
|
+
task_def["tags"]["worker-implementation"] = "scriptworker"
|
|
78
|
+
|
|
79
|
+
scope_prefix = config.graph_config["scriptworker"]["scope-prefix"]
|
|
80
|
+
scopes = task_def.setdefault("scopes", [])
|
|
81
|
+
scopes.append(f"{scope_prefix}:bitrise:app:{bitrise['app']}")
|
|
82
|
+
scopes.extend(
|
|
83
|
+
[f"{scope_prefix}:bitrise:workflow:{wf}" for wf in bitrise["workflows"]]
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Set some build_params implicitly from Taskcluster params.
|
|
87
|
+
build_params.setdefault("commit_hash", config.params["head_rev"])
|
|
88
|
+
build_params.setdefault("branch_repo_owner", config.params["head_repository"])
|
|
89
|
+
|
|
90
|
+
if config.params["head_ref"]:
|
|
91
|
+
build_params.setdefault("branch", config.params["head_ref"])
|
|
92
|
+
|
|
93
|
+
if config.params["head_tag"]:
|
|
94
|
+
build_params.setdefault("tag", config.params["head_tag"])
|
|
95
|
+
|
|
96
|
+
if config.params["tasks_for"] == "github-pull-request":
|
|
97
|
+
build_params.setdefault("pull_request_author", config.params["owner"])
|
|
98
|
+
|
|
99
|
+
if config.params["base_ref"]:
|
|
100
|
+
build_params.setdefault("branch_dest", config.params["base_ref"])
|
|
101
|
+
|
|
102
|
+
if config.params["base_repository"]:
|
|
103
|
+
build_params.setdefault(
|
|
104
|
+
"branch_dest_repo_owner", config.params["base_repository"]
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@payload_builder(
|
|
109
|
+
"scriptworker-shipit",
|
|
110
|
+
schema={
|
|
111
|
+
Required("release-name"): str,
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
def build_shipit_payload(config, task, task_def):
|
|
115
|
+
worker = task["worker"]
|
|
116
|
+
task_def["tags"]["worker-implementation"] = "scriptworker"
|
|
117
|
+
task_def["payload"] = {"release_name": worker["release-name"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mozilla-taskgraph
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Mozilla-specific transforms and utilities for Taskgraph
|
|
5
5
|
Home-page: https://github.com/mozilla-releng/mozilla-taskgraph
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -12,3 +12,4 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Topic :: Software Development
|
|
14
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: taskcluster-taskgraph<8,>=5.4
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
from pprint import pprint
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
from taskgraph.transforms.task import payload_builders
|
|
6
|
+
from taskgraph.util.schema import validate_schema
|
|
7
|
+
|
|
8
|
+
from mozilla_taskgraph import worker_types
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.parametrize(
|
|
12
|
+
"worker,extra_params,expected",
|
|
13
|
+
(
|
|
14
|
+
pytest.param({}, {}, Exception, id="missing bitrise"),
|
|
15
|
+
pytest.param({"bitrise": {"workflows": []}}, {}, Exception, id="missing app"),
|
|
16
|
+
pytest.param(
|
|
17
|
+
{"bitrise": {"app": "foo"}}, {}, Exception, id="missing workflows"
|
|
18
|
+
),
|
|
19
|
+
pytest.param(
|
|
20
|
+
{"bitrise": {"app": "some-app", "workflows": ["bar", "baz"]}},
|
|
21
|
+
{},
|
|
22
|
+
{
|
|
23
|
+
"payload": {
|
|
24
|
+
"branch": "default",
|
|
25
|
+
"branch_repo_owner": "http://example.com/head/repo",
|
|
26
|
+
"commit_hash": "abcdef",
|
|
27
|
+
},
|
|
28
|
+
"scopes": [
|
|
29
|
+
"foo:bitrise:app:some-app",
|
|
30
|
+
"foo:bitrise:workflow:bar",
|
|
31
|
+
"foo:bitrise:workflow:baz",
|
|
32
|
+
],
|
|
33
|
+
"tags": {"worker-implementation": "scriptworker"},
|
|
34
|
+
},
|
|
35
|
+
id="default params",
|
|
36
|
+
),
|
|
37
|
+
pytest.param(
|
|
38
|
+
{"bitrise": {"app": "some-app", "workflows": ["bar"]}},
|
|
39
|
+
{"tasks_for": "github-pull-request"},
|
|
40
|
+
{
|
|
41
|
+
"payload": {
|
|
42
|
+
"branch": "default",
|
|
43
|
+
"branch_dest": "123456",
|
|
44
|
+
"branch_dest_repo_owner": "http://example.com/base/repo",
|
|
45
|
+
"branch_repo_owner": "http://example.com/head/repo",
|
|
46
|
+
"commit_hash": "abcdef",
|
|
47
|
+
"pull_request_author": "some-owner",
|
|
48
|
+
},
|
|
49
|
+
"scopes": ["foo:bitrise:app:some-app", "foo:bitrise:workflow:bar"],
|
|
50
|
+
"tags": {"worker-implementation": "scriptworker"},
|
|
51
|
+
},
|
|
52
|
+
id="pull request",
|
|
53
|
+
),
|
|
54
|
+
pytest.param(
|
|
55
|
+
{"bitrise": {"app": "some-app", "workflows": ["bar"]}},
|
|
56
|
+
{
|
|
57
|
+
"base_ref": "",
|
|
58
|
+
"base_repository": "",
|
|
59
|
+
"head_ref": "",
|
|
60
|
+
"head_tag": "some-tag",
|
|
61
|
+
"tasks_for": "github-pull-request",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"payload": {
|
|
65
|
+
"branch_repo_owner": "http://example.com/head/repo",
|
|
66
|
+
"commit_hash": "abcdef",
|
|
67
|
+
"pull_request_author": "some-owner",
|
|
68
|
+
"tag": "some-tag",
|
|
69
|
+
},
|
|
70
|
+
"scopes": ["foo:bitrise:app:some-app", "foo:bitrise:workflow:bar"],
|
|
71
|
+
"tags": {"worker-implementation": "scriptworker"},
|
|
72
|
+
},
|
|
73
|
+
id="opposite params", # this test helps hit other half of if statements
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
def test_build_bitrise_payload(
|
|
78
|
+
make_graph_config, make_transform_config, parameters, worker, extra_params, expected
|
|
79
|
+
):
|
|
80
|
+
schema = payload_builders["scriptworker-bitrise"].schema
|
|
81
|
+
|
|
82
|
+
graph_config = make_graph_config(
|
|
83
|
+
extra_config={"scriptworker": {"scope-prefix": "foo"}}
|
|
84
|
+
)
|
|
85
|
+
parameters.update(extra_params)
|
|
86
|
+
config = make_transform_config(params=parameters, graph_cfg=graph_config)
|
|
87
|
+
|
|
88
|
+
worker.setdefault("implementation", "scriptworker-bitrise")
|
|
89
|
+
task = {"worker": worker}
|
|
90
|
+
task_def = {"tags": {}}
|
|
91
|
+
|
|
92
|
+
if inspect.isclass(expected) and issubclass(expected, Exception):
|
|
93
|
+
with pytest.raises(expected):
|
|
94
|
+
validate_schema(schema, worker, "schema error")
|
|
95
|
+
worker_types.build_bitrise_payload(config, task, task_def)
|
|
96
|
+
else:
|
|
97
|
+
validate_schema(schema, worker, "schema error")
|
|
98
|
+
worker_types.build_bitrise_payload(config, task, task_def)
|
|
99
|
+
print("Dumping result:")
|
|
100
|
+
pprint(task_def, indent=2)
|
|
101
|
+
assert task_def == expected
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_build_shipit_payload():
|
|
105
|
+
task = {"worker": {"release-name": "foo"}}
|
|
106
|
+
task_def = {"tags": {}}
|
|
107
|
+
worker_types.build_shipit_payload(None, task, task_def)
|
|
108
|
+
assert task_def == {
|
|
109
|
+
"payload": {"release_name": "foo"},
|
|
110
|
+
"tags": {"worker-implementation": "scriptworker"},
|
|
111
|
+
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from taskgraph.transforms.task import payload_builder
|
|
2
|
-
from voluptuous import Required
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@payload_builder(
|
|
6
|
-
"scriptworker-shipit",
|
|
7
|
-
schema={
|
|
8
|
-
Required("release-name"): str,
|
|
9
|
-
},
|
|
10
|
-
)
|
|
11
|
-
def build_shipit_payload(config, task, task_def):
|
|
12
|
-
worker = task["worker"]
|
|
13
|
-
task_def["tags"]["worker-implementation"] = "scriptworker"
|
|
14
|
-
task_def["payload"] = {"release_name": worker["release-name"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from mozilla_taskgraph import worker_types
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_build_shipit_payload():
|
|
5
|
-
task = {"worker": {"release-name": "foo"}}
|
|
6
|
-
task_def = {"tags": {}}
|
|
7
|
-
worker_types.build_shipit_payload(None, task, task_def)
|
|
8
|
-
assert task_def == {
|
|
9
|
-
"payload": {"release_name": "foo"},
|
|
10
|
-
"tags": {"worker-implementation": "scriptworker"},
|
|
11
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/actions/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph/transforms/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph.egg-info/requires.txt
RENAMED
|
File without changes
|
{mozilla-taskgraph-1.2.2 → mozilla-taskgraph-1.3.0}/src/mozilla_taskgraph.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|