Example #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
Example #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')
def java_sources_staging_output(execution_id):
    step_props = JavaSourcesStagingHost.host_step_properties(execution_id)
    artifact_name = ConfigUtils.artifact_yaml_name()
    pr_url = None

    if ConfigUtils.check_artifact_exist(step_props, artifact_name):
        artifact = ConfigUtils.read_config(
            step_props.host_guest_output_dir_subpath(
                ConfigUtils.artifact_yaml_name()))
        pr_url = artifact['pr_url']

    rows = HtmlUtils.generate_html_from_console_output(
        step_props.stdout_file_path())
    stream = ServiceUtils.stream_template('java_sources_staging_output.html',
                                          rows=rows, pr_url=pr_url,
                                          output_link=step_props.temp_path())
    return Response(stream, mimetype='text/html')