Exemple #1
0
def parse_args(pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser.add_argument(
        "--repo-task",
        type=str,
        action="append",
        required=False,
        default=[],
        help="postprocess install, list_metadata, or audit tasks."
        "Defaults to none of them.",
    )
    return parser
def parse_args(
        pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_graphviz_graph_args(parser)
    parser.add_argument(
        "-m",
        "--manifest-path",
        type=str,
        required=False,
        default=None,
        help="Filter to only display results for one Cargo.toml manifest",
    )
    return parser
def parse_args(
        pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_docker_args(parser)
    parser = add_volume_args(parser)
    parser.add_argument(
        "-t",
        "--tags",
        action="store_true",
        default=False,
        required=False,
        help="Output metadata for each tag in the repo. Defaults to False.",
    )
    return parser
Exemple #4
0
def parse_args(
        pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_docker_args(parser)
    parser = add_volume_args(parser)
    parser.add_argument(
        "--glob",
        type=str,
        action="append",
        required=False,
        default=list(dependency_file_patterns.keys()),
        help=f"manifest globs to search for dep files in the repo. "
        f"Defaults to: {list(dependency_file_patterns.keys())}",
    )
    return parser
Exemple #5
0
def parse_args(
        pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_aiohttp_args(parser)
    parser.add_argument(
        "--max-retries",
        help=
        "max times to retry a query with jitter and exponential backoff (defaults to 12)"
        "Ignores 404s errors",
        type=int,
        default=12,
    )
    parser.add_argument(
        "--dry-run",
        action="store_true",
        required=False,
        default=False,
        help=
        "Print commands we would run and their context, but don't run them.",
    )
    parser.add_argument(
        dest="package_task",
        type=str,
        choices=["fetch_npmsio_scores", "fetch_npm_registry_metadata"],
        default="fetch_npmsio_scores",
        help="Task to run on each package. Defaults to 'fetch_npmsio_scores'",
    )
    parser.add_argument(
        "--package-batch-size",
        type=int,
        required=False,
        default=50,
        help="Number of packages per fetch_npmsio_scores request or"
        " concurrent fetch_npm_registry_metadata requests to run. Defaults to 50.",
    )
    parser.add_argument(
        "--npm-auth-token",
        default=os.environ.get("NPM_PAT", None),
        help="An npm registry access token for fetch_npm_registry_metadata."
        " Defaults NPM_PAT env var. Should be read-only.",
    )
    return parser
Exemple #6
0
def parse_args(
        pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_db_arg(parser)
    parser.add_argument(
        "--create-tables",
        action="store_true",
        required=False,
        default=False,
        help="Creates tables in the DB.",
    )
    parser.add_argument(
        "--create-views",
        action="store_true",
        required=False,
        default=False,
        help="Creates materialized views in the DB.",
    )
    parser.add_argument("--input-type",
                        type=str,
                        required=True,
                        help="Input type to save.")
    return parser
Exemple #7
0
def parse_args(pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_aiohttp_args(parser)
    parser.add_argument(
        "--github-accept-header",
        nargs="*",
        action="append",
        default=[
            # https://developer.github.com/v4/previews/#access-to-a-repositories-dependency-graph
            "application/vnd.github.hawkgirl-preview+json",
            # https://developer.github.com/v4/previews/#repository-vulnerability-alerts
            "application/vnd.github.vixen-preview+json",
        ],
    )
    parser.add_argument(
        "--github-auth-token",
        default=os.environ.get("GITHUB_PAT", None),
        help="A github personal access token. Defaults GITHUB_PAT env var. It"
        "should have most of the scopes from"
        "https://developer.github.com/v4/guides/forming-calls/#authenticating-with-graphql",
    )
    parser.add_argument(
        "--github-workers",
        help="the number of concurrent workers to run github requests (defaults to 3)",
        type=int,
        default=3,
    )
    query_types = [k.name for k in ResourceKind]
    parser.add_argument(
        "--github-query-type",
        help="a github query type to fetch. Defaults to all types",
        action="append",
        choices=query_types,
    )
    parser.add_argument(
        "--github-repo-langs-page-size",
        help="number of github repo langs to fetch with each request (defaults to 25)",
        type=int,
        default=25,
    )
    parser.add_argument(
        "--github-repo-dep-manifests-page-size",
        help="number of github repo dep manifests to fetch with each request (defaults to 1)",
        type=int,
        default=1,
    )
    parser.add_argument(
        "--github-repo-dep-manifest-deps-page-size",
        help="number of github repo deps for a manifest to fetch with each request (defaults to 100)",
        type=int,
        default=100,
    )
    parser.add_argument(
        "--github-repo-vuln-alerts-page-size",
        help="number of github repo vuln alerts to fetch with each request (defaults to 25)",
        type=int,
        default=25,
    )
    parser.add_argument(
        "--github-repo-vuln-alert-vulns-page-size",
        help="number of github repo vulns per alerts to fetch with each request (defaults to 25)",
        type=int,
        default=25,
    )
    parser.add_argument(
        "--github-poll-seconds",
        help="frequency in seconds to check whether worker queues are empty and quit (defaults to 3)",
        type=int,
        default=3,
    )
    parser.add_argument(
        "--github-max-retries",
        help="max times to retry a query with jitter and exponential backoff (defaults to 12)"
        "Ignores 404s and graphql not found errors",
        type=int,
        default=12,
    )
    return parser
Exemple #8
0
def parse_args(
        pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_docker_args(parser)
    parser = add_volume_args(parser)
    parser.add_argument(
        "--dry-run",
        action="store_true",
        required=False,
        default=False,
        help=
        "Print commands we would run and their context, but don't run them.",
    )
    parser.add_argument(
        "--git-clean",
        action="store_true",
        required=False,
        default=False,
        help=
        "Run 'git clean -fdx' for each ref to clear package manager caches. "
        "Slower but better isolation. Defaults to false.",
    )
    parser.add_argument(
        "--use-cache",
        action="store_true",
        required=False,
        default=True,
        help=
        "Cache and results for the same repo, and dep file directory and SHA2"
        "sums for multiple git refs (NB: ignores changes to non-dep files e.g. to "
        "node.js install hook scripts).",
    )
    parser.add_argument(
        "--dir",
        type=str,
        required=False,
        default=None,
        help="Only run against matching directory. "
        "e.g. './' for root directory or './packages/fxa-js-client/' for a subdirectory",
    )
    parser.add_argument(
        "--language",
        type=str,
        action="append",
        required=False,
        choices=language_names,
        default=[],
        help="Package managers to run commands for. Defaults to all of them.",
    )
    parser.add_argument(
        "--package-manager",
        type=str,
        action="append",
        required=False,
        choices=package_manager_names,
        default=[],
        help="Package managers to run commands for. Defaults to all of them.",
    )
    parser.add_argument(
        "--docker-image",
        type=str,
        action="append",
        required=False,
        choices=docker_image_names,
        default=[],
        help="Docker images to run commands in. Defaults to all of them.",
    )
    parser.add_argument(
        "--repo-task",
        type=str,
        action="append",
        required=False,
        default=[],
        help="Run install, list_metadata, or audit tasks in the order provided. "
        "Defaults to none of them.",
    )
    return parser
Exemple #9
0
def parse_args(
        pipeline_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
    parser = add_infile_and_outfile(pipeline_parser)
    parser = add_graphviz_graph_args(parser)
    return parser