Example #1
0
job_type = sys.argv[2]
job_name = splitext(basename(job_config_path))[0]
print("[INFO] Generating configuration for {} job {}".format(
    job_type, job_name))
job_config = load_configuration(job_config_path)
print("[INFO] Using configuration:\n{}".format(
    dump(job_config, default_flow_style=False, explicit_start=True)))

actions = []

if job_type == "test":
    for parameter in job_config.get("parameters", []):
        actions.append(
            ParameterAction(
                name=parameter.get("name"),
                description=parameter.get("description"),
                default_value=parameter.get("default_value", ""),
            ))

    # all jobs will install the tool first
    actions.append(OCTInstallAction())

    # next, all jobs will provision a remote VM
    actions.append(
        ProvisionAction(
            os=job_config["provision"]["os"],
            stage=job_config["provision"]["stage"],
            provider=job_config["provision"]["provider"],
        ))

    # next, repositories will be synced to the remote VM
Example #2
0
actions = []

if job_type == "test":
    debug("[INFO] Handling a test job")
    # the last parameter with a given name is used
    existing_parameters = []
    for parameter in reversed(job_config.get("parameters", [])):
        parameter_name = parameter.get("name")
        if parameter_name in existing_parameters:
            continue

        debug("[INFO] Adding parameter: " + parameter_name)
        actions.insert(0, ParameterAction(
            name=parameter_name,
            description=parameter.get("description"),
            default_value=parameter.get("default_value", ""),
        ))
        existing_parameters.append(parameter_name)

    # all jobs will install the tool first
    actions.append(OCTInstallAction())

    # next, all jobs will provision a remote VM
    actions.append(ProvisionAction(
        os=job_config["provision"]["os"],
        stage=job_config["provision"]["stage"],
        provider=job_config["provision"]["provider"],
    ))

    # next, repositories will be synced to the remote VM