How to use the taskgraph.util.schema.Schema function in taskgraph

To help you get started, we’ve selected a few taskgraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla-mobile / fenix / taskcluster / fenix_taskgraph / job.py View on Github external
Required("key"): text_type,
    Optional("json"): bool,
}

gradlew_schema = Schema({
    Required("using"): "gradlew",
    Optional("pre-gradlew"): [[text_type]],
    Required("gradlew"): [text_type],
    Optional("post-gradlew"): [[text_type]],
    # Base work directory used to set up the task.
    Required("workdir"): text_type,
    Optional("use-caches"): bool,
    Optional("secrets"): [secret_schema],
})

run_commands_schema = Schema({
    Required("using"): "run-commands",
    Required("commands"): [[taskref_or_string]],
    Required("workdir"): text_type,
    Optional("use-caches"): bool,
    Optional("secrets"): [secret_schema],
})


@run_job_using("docker-worker", "run-commands", schema=run_commands_schema)
def configure_run_commands_schema(config, job, taskdesc):
    run = job["run"]
    pre_commands = [
        _generate_secret_command(secret) for secret in run.get("secrets", [])
    ]
    all_commands = pre_commands + run.pop("commands", [])
github mozilla-mobile / fenix / taskcluster / fenix_taskgraph / job.py View on Github external
from taskgraph.transforms.job import run_job_using, configure_taskdesc_for_run
from taskgraph.util import path
from taskgraph.util.schema import Schema, taskref_or_string
from voluptuous import Required, Optional
from six import text_type

from pipes import quote as shell_quote

secret_schema = {
    Required("name"): text_type,
    Required("path"): text_type,
    Required("key"): text_type,
    Optional("json"): bool,
}

gradlew_schema = Schema({
    Required("using"): "gradlew",
    Optional("pre-gradlew"): [[text_type]],
    Required("gradlew"): [text_type],
    Optional("post-gradlew"): [[text_type]],
    # Base work directory used to set up the task.
    Required("workdir"): text_type,
    Optional("use-caches"): bool,
    Optional("secrets"): [secret_schema],
})

run_commands_schema = Schema({
    Required("using"): "run-commands",
    Required("commands"): [[taskref_or_string]],
    Required("workdir"): text_type,
    Optional("use-caches"): bool,
    Optional("secrets"): [secret_schema],