|
14 | 14 | from code_coverage_tools.log import init_logger |
15 | 15 |
|
16 | 16 |
|
17 | | -def setup_cli(ask_repository=True, ask_revision=True): |
| 17 | +def setup_cli(parameters=True): |
18 | 18 | """ |
19 | 19 | Setup CLI options parser and taskcluster bootstrap |
20 | 20 | """ |
21 | 21 | parser = argparse.ArgumentParser(description="Mozilla Code Coverage Bot") |
22 | | - if ask_repository: |
| 22 | + if parameters: |
23 | 23 | parser.add_argument("--repository", default=os.environ.get("REPOSITORY")) |
24 | | - if ask_revision: |
| 24 | + |
| 25 | + parser.add_argument("--task-group-id", default=os.environ.get("TASK_GROUP_ID")) |
| 26 | + |
25 | 27 | parser.add_argument("--revision", default=os.environ.get("REVISION")) |
| 28 | + |
26 | 29 | parser.add_argument( |
27 | 30 | "--cache-root", required=True, help="Cache root, used to pull changesets" |
28 | 31 | ) |
@@ -50,6 +53,18 @@ def setup_cli(ask_repository=True, ask_revision=True): |
50 | 53 | parser.add_argument("--taskcluster-access-token", help="Taskcluster Access token") |
51 | 54 | args = parser.parse_args() |
52 | 55 |
|
| 56 | + if parameters: |
| 57 | + if args.task_group_id and (args.repository or args.revision): |
| 58 | + parser.error( |
| 59 | + "Provide either --task-group-id or --repository/--revision, not both." |
| 60 | + ) |
| 61 | + |
| 62 | + if args.repository and not args.revision: |
| 63 | + parser.error("--repository requires --revision") |
| 64 | + |
| 65 | + if not args.task_group_id and not args.repository: |
| 66 | + parser.error("Provide either --task-group-id or --repository/--revision.") |
| 67 | + |
53 | 68 | # Auth on Taskcluster |
54 | 69 | taskcluster_config.auth(args.taskcluster_client_id, args.taskcluster_access_token) |
55 | 70 |
|
|
0 commit comments