Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/gen_ed25519_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
easier standalone use. It could easily be a `console_script` though.

"""

from __future__ import print_function

import base64
Expand Down
1 change: 1 addition & 0 deletions src/scriptworker/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
log (logging.Logger): the log object for the module

"""

import asyncio
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/scriptworker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
credentials, if they aren't in the config file or environment.

"""

import argparse
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/scriptworker/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
DEFAULT_MAX_CONCURRENT_DOWNLOADS (int): default max concurrent downloads

"""

import asyncio
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions src/scriptworker/cot/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
log (logging.Logger): the log object for this module.

"""

import logging
import os

Expand Down
20 changes: 6 additions & 14 deletions src/scriptworker/cot/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,8 @@ async def download_cot_artifact(chain, task_id, path):
link = chain.get_link(task_id)
log.debug("Verifying {} is in {} cot artifacts...".format(path, task_id))
if not link.cot:
log.warning(
'Chain of Trust for "{}" in {} does not exist. See above log for more details. \
Skipping download of this artifact'.format(
path, task_id
)
)
log.warning('Chain of Trust for "{}" in {} does not exist. See above log for more details. \
Skipping download of this artifact'.format(path, task_id))
return

if path not in link.cot["artifacts"]:
Expand Down Expand Up @@ -2105,8 +2101,7 @@ def verify_cot_cmdln(args=None, event_loop=None):

"""
args = args or sys.argv[1:]
parser = argparse.ArgumentParser(
description="""Verify a given task's chain of trust.
parser = argparse.ArgumentParser(description="""Verify a given task's chain of trust.

Given a task's `task_id`, get its task definition, then trace its chain of
trust back to the tree. This doesn't verify chain of trust artifact signatures,
Expand All @@ -2118,8 +2113,7 @@ def verify_cot_cmdln(args=None, event_loop=None):
or in the CREDS_FILES http://bit.ly/2fVMu0A

If you are verifying against a private github repo, please also set in environment
SCRIPTWORKER_GITHUB_OAUTH_TOKEN to an OAUTH token with read permissions to the repo"""
)
SCRIPTWORKER_GITHUB_OAUTH_TOKEN to an OAUTH token with read permissions to the repo""")
parser.add_argument("task_id", help="the task id to test")
parser.add_argument("--task-type", help="the task type to test", choices=sorted(get_valid_task_types().keys()), required=True)
parser.add_argument("--cleanup", help="clean up the temp dir afterwards", dest="cleanup", action="store_true", default=False)
Expand Down Expand Up @@ -2186,15 +2180,13 @@ def create_test_workdir(args=None, event_loop=None):

"""
args = args or sys.argv[1:]
parser = argparse.ArgumentParser(
description="""Populate a test `work_dir`.
parser = argparse.ArgumentParser(description="""Populate a test `work_dir`.

Given a scriptworker task's `task_id`, get its task definition, write it to
`./work/task.json`, then download its `upstreamArtifacts` and put them in
`./work/cot/TASK_ID/PATH`.

This is helpful in manually testing a *script run."""
)
This is helpful in manually testing a *script run.""")
parser.add_argument("--path", help="relative path to the work_dir", default="work")
parser.add_argument("--overwrite", help="overwrite an existing work_dir", action="store_true")
parser.add_argument("task_id", help="the task id to test")
Expand Down
7 changes: 3 additions & 4 deletions src/scriptworker/ed25519.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
log (logging.Logger): the log object for the module

"""

import argparse
import base64
import functools
Expand Down Expand Up @@ -140,13 +141,11 @@ def verify_ed25519_signature_cmdln(args=None, exception=SystemExit):

"""
args = args or sys.argv[1:]
parser = argparse.ArgumentParser(
description="""Verify an ed25519 signature from the command line.
parser = argparse.ArgumentParser(description="""Verify an ed25519 signature from the command line.

Given a file and its detached signature, verify that it has been signed with
a valid key. This key can be specified on the command line; otherwise we'll
default to ``config['ed25519_public_keys']``."""
)
default to ``config['ed25519_public_keys']``.""")
parser.add_argument("--pubkey", help="path to a base64-encoded ed25519 pubkey, optional")
parser.add_argument("file_path")
parser.add_argument("sig_path")
Expand Down
1 change: 1 addition & 0 deletions src/scriptworker/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
log (logging.Logger): the log object for this module.

"""

import asyncio
import logging
import logging.handlers
Expand Down
1 change: 1 addition & 0 deletions src/scriptworker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
log (logging.Logger): the log object for the module

"""

import asyncio
import functools
import hashlib
Expand Down
1 change: 1 addition & 0 deletions src/scriptworker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
log (logging.Logger): the log object for the module.

"""

import asyncio
import logging
import signal
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test base files"""

import asyncio
import json
import os
Expand Down
1 change: 1 addition & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.config"""

import json
import os
from copy import deepcopy
Expand Down
1 change: 1 addition & 0 deletions tests/test_context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.context"""

import asyncio
import json
import os
Expand Down
1 change: 1 addition & 0 deletions tests/test_cot_generate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.cot.generate"""

import logging
import os

Expand Down
3 changes: 2 additions & 1 deletion tests/test_cot_verify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.cot.verify"""

import json
import logging
import os
Expand Down Expand Up @@ -2179,7 +2180,7 @@ async def test_trace_back_to_tree_diff_repo(chain, decision_link, build_link, do
async def test_trace_back_to_tree_mobile_staging_repos_dont_access_restricted_scopes(
mobile_chain, mobile_github_release_link, mobile_build_link, source_url, raises, mocker
):
(source_url, raises) = ("https://github.com/mozilla-mobile/reference-browser", False)
source_url, raises = ("https://github.com/mozilla-mobile/reference-browser", False)
mobile_github_release_link.task["metadata"]["source"] = source_url
mobile_chain.links = [mobile_github_release_link, mobile_build_link]
mocker.patch.object(mobile_chain, "is_try_or_pull_request", new=create_async(result=False))
Expand Down
9 changes: 3 additions & 6 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Scriptworker integration tests."""

import asyncio
import json
import logging
Expand Down Expand Up @@ -36,8 +37,7 @@ def read_integration_creds():
creds = read_worker_creds(key="integration_credentials")
if creds:
return creds
raise Exception(
"""To run integration tests, put your worker-test clientId creds, in json format,
raise Exception("""To run integration tests, put your worker-test clientId creds, in json format,
in one of these files:

{files}
Expand All @@ -54,10 +54,7 @@ def read_integration_creds():

This clientId will need the scope assume:project:taskcluster:worker-test-scopes

To skip integration tests, set the environment variable NO_CREDENTIALS_TESTS""".format(
files=CREDS_FILES
)
)
To skip integration tests, set the environment variable NO_CREDENTIALS_TESTS""".format(files=CREDS_FILES))


def build_config(override, basedir):
Expand Down
1 change: 1 addition & 0 deletions tests/test_log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.log"""

import asyncio
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions tests/test_production.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Scriptworker production CoT verification tests."""

import json
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions tests/test_task.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.task"""

import asyncio
import glob
import json
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.utils"""

import asyncio
import os
import re
Expand Down
1 change: 1 addition & 0 deletions tests/test_worker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
"""Test scriptworker.worker"""

import asyncio
import json
import os
Expand Down