예제 #1
0
def sources_generation_download(execution_id):
    step_props = SourcesGenerationHost.host_step_properties(execution_id)
    artifact_name = ConfigUtils.artifact_name()

    if ConfigUtils.check_artifact_exist(step_props, artifact_name):
        return send_from_directory(step_props.host_guest_output_dir_path(),
                                   artifact_name,
                                   as_attachment=True,
                                   attachment_filename=artifact_name,
                                   mimetype='application/gzip')
    else:
        return 'The artifact does not exist. Please ensure that the provided ' \
               'execution_id is correct and the generation phase is finished ' \
               'and try again', 404
예제 #2
0
def sources_generation_output(execution_id):
    step_props = SourcesGenerationHost.host_step_properties(execution_id)
    artifact_name = ConfigUtils.artifact_name()
    download_link = None
    if ConfigUtils.check_artifact_exist(step_props, artifact_name):
        download_link = "/sources-generation/%s/download" % execution_id

    rows = HtmlUtils.generate_html_from_console_output(
        step_props.stdout_file_path())

    output_path = step_props.temp_path()
    stream = ServiceUtils.stream_template('sources_generation_output.html',
                                          rows=rows,
                                          download_link=download_link,
                                          output_link=output_path)
    return Response(stream, mimetype='text/html')
예제 #3
0
def java_sources_staging():
    step_props = JavaSourcesStagingHost.host_step_properties(
        ConfigUtils.generate_id('java-src-stage-'))

    config_yaml = ServiceUtils.get_step_config(request.form,
                                               'java_sources_staging.yaml',
                                               _params_to_yaml)
    artifacts_zip_path = step_props.temp_subpath(ConfigUtils.artifact_name())
    config_yaml['generator_artifacts']['sources_zip'] = artifacts_zip_path
    execution_id = step_props.execution_id()
    config_yaml['staging']['git_branch'] = execution_id
    config_yaml['execution_id'] = execution_id

    ServiceUtils.run_host_step(JavaSourcesStagingHost(config_yaml))

    step = JavaSourcesStagingHost(config_yaml)
    step.pre_execute()
    request.files['generator_artifacts_sources_zip'].save(artifacts_zip_path)
    ServiceUtils.run_host_step(step)

    return redirect("/java-sources-staging/%s" % step_props.execution_id())
예제 #4
0
def _check_artifacts_exist(step_props):
    artifacts_fl = step_props.host_guest_output_dir_subpath(
        ConfigUtils.artifact_name())
    return os.path.isfile(artifacts_fl)