Skip to content

Commit bd7a351

Browse files
committed
ci: add custom parameter for pull request
This will allow us to index tasks by pull request which can help testing changes in external repos.
1 parent a7262b7 commit bd7a351

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

taskcluster/self_taskgraph/custom_parameters.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

5+
import os
6+
7+
from voluptuous import All, Any, Range, Required
8+
9+
from taskgraph.parameters import extend_parameters_schema
10+
11+
12+
def get_defaults(repo_root):
13+
return {
14+
"pull_request_number": None,
15+
}
16+
17+
18+
extend_parameters_schema(
19+
{
20+
Required("pull_request_number"): Any(All(int, Range(min=1)), None),
21+
},
22+
defaults_fn=get_defaults,
23+
)
24+
525

626
def decision_parameters(graph_config, parameters):
727
if parameters["tasks_for"] == "github-release":
828
parameters["target_tasks_method"] = "release"
29+
30+
pr_number = os.environ.get("TASKGRAPH_PULL_REQUEST_NUMBER", None)
31+
parameters["pull_request_number"] = None if pr_number is None else int(pr_number)

taskcluster/test/params/main-repo-pull-request-untrusted.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ moz_build_date: '20220421203159'
1717
optimize_target_tasks: true
1818
1919
project: taskgraph
20+
pull_request_number: 123
2021
pushdate: 0
2122
pushlog_id: '0'
2223
repository_type: git

taskcluster/test/params/main-repo-pull-request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ moz_build_date: '20220421203159'
1717
optimize_target_tasks: true
1818
1919
project: taskgraph
20+
pull_request_number: 123
2021
pushdate: 0
2122
pushlog_id: '0'
2223
repository_type: git

0 commit comments

Comments
 (0)