scriptworker 60.1.0__tar.gz → 60.2.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.
Files changed (40) hide show
  1. {scriptworker-60.1.0 → scriptworker-60.2.0}/HISTORY.rst +12 -0
  2. {scriptworker-60.1.0 → scriptworker-60.2.0}/PKG-INFO +1 -1
  3. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/client.py +2 -3
  4. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/constants.py +1 -9
  5. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/context.py +2 -2
  6. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/cot/verify.py +14 -8
  7. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/task.py +2 -2
  8. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/utils.py +7 -0
  9. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/version.py +1 -1
  10. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/worker.py +2 -2
  11. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker.egg-info/PKG-INFO +1 -1
  12. {scriptworker-60.1.0 → scriptworker-60.2.0}/version.json +2 -2
  13. {scriptworker-60.1.0 → scriptworker-60.2.0}/CONTRIBUTING.rst +0 -0
  14. {scriptworker-60.1.0 → scriptworker-60.2.0}/LICENSE +0 -0
  15. {scriptworker-60.1.0 → scriptworker-60.2.0}/MANIFEST.in +0 -0
  16. {scriptworker-60.1.0 → scriptworker-60.2.0}/README.rst +0 -0
  17. {scriptworker-60.1.0 → scriptworker-60.2.0}/pyproject.toml +0 -0
  18. {scriptworker-60.1.0 → scriptworker-60.2.0}/requirements.txt +0 -0
  19. {scriptworker-60.1.0 → scriptworker-60.2.0}/scripts/gen_ed25519_key.py +0 -0
  20. {scriptworker-60.1.0 → scriptworker-60.2.0}/scriptworker.yaml.tmpl +0 -0
  21. {scriptworker-60.1.0 → scriptworker-60.2.0}/setup.cfg +0 -0
  22. {scriptworker-60.1.0 → scriptworker-60.2.0}/setup.py +0 -0
  23. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/__init__.py +0 -0
  24. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/artifacts.py +0 -0
  25. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/config.py +0 -0
  26. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/cot/__init__.py +0 -0
  27. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/cot/generate.py +0 -0
  28. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/data/cot_v1_schema.json +0 -0
  29. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/ed25519.py +0 -0
  30. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/exceptions.py +0 -0
  31. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/github.py +0 -0
  32. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/log.py +0 -0
  33. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker/task_process.py +0 -0
  34. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker.egg-info/SOURCES.txt +0 -0
  35. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker.egg-info/dependency_links.txt +0 -0
  36. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker.egg-info/entry_points.txt +0 -0
  37. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker.egg-info/not-zip-safe +0 -0
  38. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker.egg-info/requires.txt +0 -0
  39. {scriptworker-60.1.0 → scriptworker-60.2.0}/src/scriptworker.egg-info/top_level.txt +0 -0
  40. {scriptworker-60.1.0 → scriptworker-60.2.0}/tox.ini +0 -0
@@ -4,6 +4,18 @@ Change Log
4
4
  All notable changes to this project will be documented in this file.
5
5
  This project adheres to `Semantic Versioning <http://semver.org/>`__.
6
6
 
7
+ 60.2.0 - 2024-07-12
8
+ -------------------
9
+
10
+ Added
11
+ ~~~~~
12
+ - Set User-Agent in http requests (#661)
13
+ - Support github-pull-request-untrusted in CoT verification (https://bugzilla.mozilla.org/show_bug.cgi?id=1906748)
14
+
15
+ Fixed
16
+ ~~~~~
17
+ - Pull project from the default branch in projects.yml (#665)
18
+
7
19
  60.1.0 - 2024-06-24
8
20
  -------------------
9
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scriptworker
3
- Version: 60.1.0
3
+ Version: 60.2.0
4
4
  Summary: TaskCluster Script Worker
5
5
  Home-page: https://github.com/mozilla-releng/scriptworker
6
6
  Author: Mozilla Release Engineering
@@ -17,13 +17,12 @@ from asyncio import AbstractEventLoop
17
17
  from typing import Any, Awaitable, Callable, Dict, List, Match, NoReturn, Optional, Tuple
18
18
  from urllib.parse import unquote
19
19
 
20
- import aiohttp
21
20
  import jsonschema
22
21
 
23
22
  from scriptworker.constants import STATUSES
24
23
  from scriptworker.context import Context
25
24
  from scriptworker.exceptions import ScriptWorkerException, ScriptWorkerTaskException, TaskVerificationError
26
- from scriptworker.utils import load_json_or_yaml, match_url_regex
25
+ from scriptworker.utils import load_json_or_yaml, match_url_regex, scriptworker_session
27
26
 
28
27
  log = logging.getLogger(__name__)
29
28
 
@@ -199,7 +198,7 @@ def _init_logging(context: Any) -> None:
199
198
 
200
199
 
201
200
  async def _handle_asyncio_loop(async_main: Callable[[Any], Awaitable[None]], context: Any) -> None:
202
- async with aiohttp.ClientSession() as session:
201
+ async with scriptworker_session() as session:
203
202
  context.session = session
204
203
  try:
205
204
  await async_main(context)
@@ -300,10 +300,8 @@ DEFAULT_CONFIG: immutabledict[str, Any] = immutabledict(
300
300
  "mobile": (
301
301
  "action",
302
302
  "cron",
303
- # On staging releases, level 1 docker images may be built in the pull-request graph
304
303
  "github-pull-request",
305
- # Similarly, docker images can be built on regular push. This is usually the case
306
- # for level 3 images
304
+ "github-pull-request-untrusted",
307
305
  "github-push",
308
306
  "github-release",
309
307
  ),
@@ -311,20 +309,14 @@ DEFAULT_CONFIG: immutabledict[str, Any] = immutabledict(
311
309
  "app-services": (
312
310
  "action",
313
311
  "cron",
314
- # On staging releases, level 1 docker images may be built in the pull-request graph
315
312
  "github-pull-request",
316
- # Similarly, docker images can be built on regular push. This is usually the case
317
- # for level 3 images
318
313
  "github-push",
319
314
  "github-release",
320
315
  ),
321
316
  "glean": (
322
317
  "action",
323
318
  "cron",
324
- # On staging releases, level 1 docker images may be built in the pull-request graph
325
319
  "github-pull-request",
326
- # Similarly, docker images can be built on regular push. This is usually the case
327
- # for level 3 images
328
320
  "github-push",
329
321
  "github-release",
330
322
  ),
@@ -24,7 +24,7 @@ from taskcluster.aio import Queue
24
24
 
25
25
  from scriptworker import task_process
26
26
  from scriptworker.exceptions import CoTError
27
- from scriptworker.utils import load_json_or_yaml_from_url, makedirs
27
+ from scriptworker.utils import load_json_or_yaml_from_url, makedirs, scriptworker_session
28
28
 
29
29
  log = logging.getLogger(__name__)
30
30
 
@@ -148,7 +148,7 @@ class Context(object):
148
148
  """
149
149
  assert self.config
150
150
  if credentials:
151
- session = self.session or aiohttp.ClientSession(loop=self.event_loop)
151
+ session = self.session or scriptworker_session(loop=self.event_loop)
152
152
  return Queue(options={"credentials": credentials, "rootUrl": self.config["taskcluster_root_url"]}, session=session)
153
153
  return None
154
154
 
@@ -78,6 +78,7 @@ from scriptworker.utils import (
78
78
  read_from_file,
79
79
  remove_empty_keys,
80
80
  rm,
81
+ scriptworker_session,
81
82
  write_to_file,
82
83
  )
83
84
  from scriptworker.version import __version_string__
@@ -1042,12 +1043,17 @@ async def get_scm_level(context, project):
1042
1043
  """
1043
1044
  await context.populate_projects()
1044
1045
  config = context.projects[project]
1045
- if "access" in config:
1046
+ if config["repo_type"] == "hg":
1046
1047
  return config["access"].replace("scm_level_", "")
1047
- elif "level" in config:
1048
- return str(config["level"])
1049
- else:
1050
- raise ValueError("Can't find level for project {}".format(project))
1048
+ elif config["repo_type"] == "git":
1049
+ # TODO: we should be using the branch that the task is actually
1050
+ # being run on
1051
+ default_branch = config.get("default_branch", "main")
1052
+ for branch in config["branches"]:
1053
+ if branch["name"] == default_branch:
1054
+ return str(branch["level"])
1055
+
1056
+ raise ValueError("Can't find level for project {}".format(project))
1051
1057
 
1052
1058
 
1053
1059
  async def _get_additional_hg_action_jsone_context(parent_link, decision_link):
@@ -1345,7 +1351,7 @@ async def populate_jsone_context(chain, parent_link, decision_link, tasks_for):
1345
1351
  jsone_context.update(await _get_additional_git_cron_jsone_context(decision_link))
1346
1352
  elif tasks_for == "action":
1347
1353
  jsone_context.update(await _get_additional_git_action_jsone_context(decision_link, parent_link))
1348
- elif tasks_for == "github-pull-request":
1354
+ elif tasks_for in ("github-pull-request", "github-pull-request-untrusted"):
1349
1355
  jsone_context.update(await _get_additional_github_pull_request_jsone_context(decision_link))
1350
1356
  elif tasks_for == "github-push":
1351
1357
  jsone_context.update(await _get_additional_github_push_jsone_context(decision_link))
@@ -2070,7 +2076,7 @@ async def verify_chain_of_trust(chain, *, check_task=False):
2070
2076
 
2071
2077
  # verify_cot_cmdln {{{1
2072
2078
  async def _async_verify_cot_cmdln(opts, tmp):
2073
- async with aiohttp.ClientSession() as session:
2079
+ async with scriptworker_session() as session:
2074
2080
  context = Context()
2075
2081
  context.session = session
2076
2082
  context.config = dict(deepcopy(DEFAULT_CONFIG))
@@ -2146,7 +2152,7 @@ SCRIPTWORKER_GITHUB_OAUTH_TOKEN to an OAUTH token with read permissions to the r
2146
2152
 
2147
2153
  # create_test_workdir {{{1
2148
2154
  async def _async_create_test_workdir(task_id, path, queue=None):
2149
- async with aiohttp.ClientSession() as session:
2155
+ async with scriptworker_session() as session:
2150
2156
  context = Context()
2151
2157
  context.session = session
2152
2158
  context.config = dict(deepcopy(DEFAULT_CONFIG))
@@ -503,7 +503,7 @@ async def is_pull_request(context, task):
503
503
 
504
504
  This checks for the following things::
505
505
 
506
- * ``task.extra.env.tasks_for`` == "github-pull-request"
506
+ * ``task.extra.env.tasks_for`` is "github-pull-request" or "github-pull-request-untrusted"
507
507
  * ``task.payload.env.MOBILE_HEAD_REPOSITORY`` doesn't come from an official repo
508
508
  * ``task.metadata.source`` doesn't come from an official repo, either
509
509
  * The last 2 items are landed on the official repo
@@ -525,7 +525,7 @@ async def is_pull_request(context, task):
525
525
  metadata_source_url = task["metadata"].get("source", "")
526
526
  repo_from_source_url, revision_from_source_url = extract_github_repo_and_revision_from_source_url(metadata_source_url)
527
527
 
528
- conditions = [tasks_for == "github-pull-request"]
528
+ conditions = [tasks_for in ("github-pull-request", "github-pull-request-untrusted")]
529
529
  urls_revisions_and_can_skip = ((repo_url_from_payload, revision_from_payload, True), (repo_from_source_url, revision_from_source_url, False))
530
530
  for repo_url, revision, can_skip in urls_revisions_and_can_skip:
531
531
  # XXX In the case of scriptworker tasks, neither the repo nor the revision is defined
@@ -25,6 +25,7 @@ import async_timeout
25
25
  import yaml
26
26
  from taskcluster.client import createTemporaryCredentials
27
27
 
28
+ import scriptworker.version
28
29
  from scriptworker.exceptions import Download404, DownloadError, ScriptWorkerException, ScriptWorkerRetryException, ScriptWorkerTaskException
29
30
 
30
31
  if TYPE_CHECKING:
@@ -37,6 +38,12 @@ else:
37
38
  log = logging.getLogger(__name__)
38
39
 
39
40
 
41
+ # scriptworker_session {{{1
42
+ def scriptworker_session(*args, **kwargs):
43
+ kwargs.setdefault("headers", {}).setdefault("User-Agent", f"scriptworker {scriptworker.version.__version_string__}")
44
+ return aiohttp.ClientSession(*args, **kwargs)
45
+
46
+
40
47
  # request {{{1
41
48
  async def request(context, url, timeout=60, method="get", good=(200,), retry=tuple(range(500, 512)), return_type="text", **kwargs):
42
49
  """Async aiohttp request wrapper.
@@ -54,7 +54,7 @@ def get_version_string(version: Union[ShortVerType, LongVerType]) -> str:
54
54
 
55
55
  # 1}}}
56
56
  # Semantic versioning 2.0.0 http://semver.org/
57
- __version__ = (60, 1, 0)
57
+ __version__ = (60, 2, 0)
58
58
  __version_string__ = get_version_string(__version__)
59
59
 
60
60
 
@@ -25,7 +25,7 @@ from scriptworker.cot.verify import ChainOfTrust, verify_chain_of_trust
25
25
  from scriptworker.exceptions import ScriptWorkerException, WorkerShutdownDuringTask
26
26
  from scriptworker.task import claim_work, complete_task, prepare_to_run_task, reclaim_task, run_task, worst_level
27
27
  from scriptworker.task_process import TaskProcess
28
- from scriptworker.utils import cleanup, filepaths_in_dir
28
+ from scriptworker.utils import cleanup, filepaths_in_dir, scriptworker_session
29
29
 
30
30
  log = logging.getLogger(__name__)
31
31
 
@@ -210,7 +210,7 @@ async def async_main(context, credentials):
210
210
  Args:
211
211
  context (scriptworker.context.Context): the scriptworker context.
212
212
  """
213
- async with aiohttp.ClientSession() as session:
213
+ async with scriptworker_session() as session:
214
214
  context.session = session
215
215
  context.credentials = credentials
216
216
  await run_tasks(context)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scriptworker
3
- Version: 60.1.0
3
+ Version: 60.2.0
4
4
  Summary: TaskCluster Script Worker
5
5
  Home-page: https://github.com/mozilla-releng/scriptworker
6
6
  Author: Mozilla Release Engineering
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version":[
3
3
  60,
4
- 1,
4
+ 2,
5
5
  0
6
6
  ],
7
- "version_string":"60.1.0"
7
+ "version_string":"60.2.0"
8
8
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes