Example #1
0
def compare_deploys(request, name, stage):
    start_deploy_id = request.GET.get('start_deploy', None)
    start_deploy = deploys_helper.get(request, start_deploy_id)
    start_build = builds_helper.get_build(request, start_deploy['buildId'])
    startSha = start_build['commit']
    repo = start_build['repo']

    end_deploy_id = request.GET.get('end_deploy', None)
    if end_deploy_id:
        end_deploy = deploys_helper.get(request, end_deploy_id)
    else:
        env = environs_helper.get_env_by_stage(request, name, stage)
        end_deploy = common.get_previous_deploy(request, env, start_deploy)
        if not end_deploy:
            end_deploy = start_deploy
    end_build = builds_helper.get_build(request, end_deploy['buildId'])
    endSha = end_build['commit']

    commits, truncated, new_start_sha = common.get_commits_batch(request, repo, startSha,
                                                                 endSha, keep_first=True)

    html = render_to_string('builds/commits.tmpl', {
        "commits": commits,
        "start_sha": new_start_sha,
        "end_sha": endSha,
        "repo": repo,
        "truncated": truncated,
        "show_checkbox": False,
    })

    return HttpResponse(html)
Example #2
0
def compare_deploys(request, name, stage):
    start_deploy_id = request.GET.get('start_deploy', None)
    start_deploy = deploys_helper.get(request, start_deploy_id)
    start_build = builds_helper.get_build(request, start_deploy['buildId'])
    startSha = start_build['commit']
    repo = start_build['repo']

    end_deploy_id = request.GET.get('end_deploy', None)
    if end_deploy_id:
        end_deploy = deploys_helper.get(request, end_deploy_id)
    else:
        env = environs_helper.get_env_by_stage(request, name, stage)
        end_deploy = common.get_previous_deploy(request, env, start_deploy)
        if not end_deploy:
            end_deploy = start_deploy
    end_build = builds_helper.get_build(request, end_deploy['buildId'])
    endSha = end_build['commit']

    commits, truncated, new_start_sha = common.get_commits_batch(
        request, repo, startSha, endSha, keep_first=True)

    html = render_to_string(
        'builds/commits.tmpl', {
            "commits": commits,
            "start_sha": new_start_sha,
            "end_sha": endSha,
            "repo": repo,
            "truncated": truncated,
            "show_checkbox": False,
        })

    return HttpResponse(html)
Example #3
0
def compare_commits(request):
    startSha = request.GET.get('start_sha')
    endSha = request.GET.get('end_sha')
    repo = request.GET.get('repo')
    commits, truncated, new_start_sha = common.get_commits_batch(request, repo,
                                                                 startSha, endSha,
                                                                 keep_first=True)
    html = render_to_string('builds/commits.tmpl', {
        "commits": commits,
        "start_sha": new_start_sha,
        "end_sha": endSha,
        "repo": repo,
        "truncated": truncated,
        "show_checkbox": False,
    })

    return HttpResponse(html)
Example #4
0
def compare_commits_datatables(request):
    startSha = request.GET.get('start_sha')
    endSha = request.GET.get('end_sha')
    repo = request.GET.get('repo')
    commits, truncated, new_start_sha = common.get_commits_batch(
        request, repo, startSha, endSha, size=2000, keep_first=True)
    html = render_to_string(
        'builds/show_commits.tmpl', {
            "commits": commits,
            "start_sha": new_start_sha,
            "end_sha": endSha,
            "repo": repo,
            "truncated": truncated,
            "show_checkbox": False,
        })

    return HttpResponse(html)
Example #5
0
def get_more_commits(request):
    startSha = request.GET.get('start_sha')
    endSha = request.GET.get('end_sha')
    repo = request.GET.get('repo')

    commits, truncated, new_start_sha = common.get_commits_batch(request, repo,
                                                                 startSha, endSha,
                                                                 keep_first=False)

    show_checkbox_str = request.GET.get('show_checkbox', 'False')
    show_checkbox = show_checkbox_str.lower() == 'true'
    pagination_id = random.randint(0, 1000000)

    rows = render_to_string('builds/commit_rows.tmpl', {
        "commits": commits,
        "show_checkbox": show_checkbox,
        "pagination_id": pagination_id
    })
    return HttpResponse(json.dumps({'rows': rows, 'new_start_sha': new_start_sha,
                                    'truncated': truncated}),
                        content_type="application/json")
Example #6
0
def patch(request, name, stage):
    env = environs_helper.get_env_by_stage(request, name, stage)
    deploy_id = request.GET.get('base_deploy', None)
    if not deploy_id:
        deploy_id = env['deployId']
    deploy = deploys_helper.get(request, deploy_id)
    build = builds_helper.get_build(request, deploy['buildId'])
    commits, truncated, new_start_sha = common.get_commits_batch(request, build['repo'],
                                                                 env['branch'],
                                                                 build['commit'],
                                                                 keep_first=True)
    return render(request, 'hotfixs/cherry_pick.html', {
        "deploy": deploy,
        "build": build,
        "env": env,
        "commits": commits,
        "start_sha": new_start_sha,
        "end_sha": build['commit'],
        "repo": build['repo'],
        "truncated": truncated,
    })
Example #7
0
def patch(request, name, stage):
    env = environs_helper.get_env_by_stage(request, name, stage)
    deploy_id = request.GET.get('base_deploy', None)
    if not deploy_id:
        deploy_id = env['deployId']
    deploy = deploys_helper.get(request, deploy_id)
    build = builds_helper.get_build(request, deploy['buildId'])
    commits, truncated, new_start_sha = common.get_commits_batch(
        request,
        build['repo'],
        env['branch'],
        build['commit'],
        keep_first=True)
    return render(
        request, 'hotfixs/cherry_pick.html', {
            "deploy": deploy,
            "build": build,
            "env": env,
            "commits": commits,
            "start_sha": new_start_sha,
            "end_sha": build['commit'],
            "repo": build['repo'],
            "truncated": truncated,
        })
Example #8
0
def get_more_commits(request):
    startSha = request.GET.get('start_sha')
    endSha = request.GET.get('end_sha')
    repo = request.GET.get('repo')

    commits, truncated, new_start_sha = common.get_commits_batch(
        request, repo, startSha, endSha, keep_first=False)

    show_checkbox_str = request.GET.get('show_checkbox', 'False')
    show_checkbox = show_checkbox_str.lower() == 'true'
    pagination_id = random.randint(0, 1000000)

    rows = render_to_string(
        'builds/commit_rows.tmpl', {
            "commits": commits,
            "show_checkbox": show_checkbox,
            "pagination_id": pagination_id
        })
    return HttpResponse(json.dumps({
        'rows': rows,
        'new_start_sha': new_start_sha,
        'truncated': truncated
    }),
                        content_type="application/json")