Ejemplo n.º 1
0
def run(cli, compile, fuzz):
    # instantiate RAFT CLI
    substitutions = { }
    # Create compilation step job configuratin
    compile_job_config = RaftJobConfig(file_path = compile, substitutions=substitutions)
    # add webhook metadata that will be included in every triggered webhook by Compile job
    compile_job_config.add_metadata({"branch":"wizbangFeature"})

    print('Compile')
    # create a new job with the Compile config and get new job ID
    # in compile_job
    compile_job = cli.new_job(compile_job_config)

    # wait for a job with ID from compile_job to finish the run
    cli.poll(compile_job['jobId'])

    substitutions['{compile.jobId}'] = compile_job['jobId']
    # create a new job config with Fuzz configuration JSON
    fuzz_job_config = RaftJobConfig(file_path = fuzz, substitutions=substitutions)
    print('Fuzz')
    # add webhook metadata that will included in every triggered webhook by Fuzz job
    fuzz_job_config.add_metadata({"branch":"wizbangFeature"})
    # create new fuzz job configuration
    fuzz_job = cli.new_job(fuzz_job_config)
    # wait for job ID from fuzz_job to finish the run
    cli.poll(fuzz_job['jobId'])
Ejemplo n.º 2
0
def run(compile, fuzz, host):
    # instantiate RAFT CLI
    cli = RaftCLI()

    # will replace {sample.host} with the value of host variable
    # see sample.restler.compile.json and sample.restler.fuzz.json
    subs = {'{sample.host}': host}
    # Create compilation job configuration
    compile_job_config = RaftJobConfig(file_path=compile, substitutions=subs)
    # add webhook metadata that will be included in every triggered webhook by Compile job
    compile_job_config.add_metadata({"branch": "wizbangFeature"})
    print('Compile')

    # submit a new job with the Compile config and get new job ID
    compile_job = cli.new_job(compile_job_config)

    # wait for a job with ID from compile_job to finish the run
    cli.poll(compile_job['jobId'])

    # use compile job as input for fuzz job
    subs['{compile.jobId}'] = compile_job['jobId']

    # create a new job config with Fuzz configuration JSON
    fuzz_job_config = RaftJobConfig(file_path=fuzz, substitutions=subs)
    print('Fuzz')
    # add webhook metadata that will included in every triggered webhook by Fuzz job
    fuzz_job_config.add_metadata({"branch": "wizbangFeature"})
    # create new fuzz job configuration
    fuzz_job = cli.new_job(fuzz_job_config)

    # wait for job ID from fuzz_job to finish the run
    cli.poll(fuzz_job['jobId'])