def get_all_builds(request): name = request.GET.get('name') branch = request.GET.get('branch') index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', common.DEFAULT_BUILD_SIZE)) builds = builds_helper.get_builds_and_tags(request, name=name, branch=branch, pageIndex=index, pageSize=size) scm_url = systems_helper.get_scm_url(request) deploy_state = None current_build_id = request.GET.get('current_build_id', None) override_policy = request.GET.get('override_policy') deploy_id = request.GET.get('deploy_id') current_build = None if current_build_id: current_build = builds_helper.get_build_and_tag(request, current_build_id) current_build = current_build.get('build') if deploy_id: deploy_config = deploys_helper.get(request, deploy_id) if deploy_config: deploy_state = deploy_config.get('state', None) html = render_to_string('builds/pick_a_build.tmpl', { "builds": builds, "current_build": current_build, "scm_url": scm_url, "buildName": name, "branch": branch, "pageIndex": index, "pageSize": common.DEFAULT_BUILD_SIZE, "disablePrevious": index <= 1, "disableNext": len(builds) < common.DEFAULT_BUILD_SIZE, "overridePolicy": override_policy, "deployState": deploy_state, }) return HttpResponse(html)
def get_all_builds(request): name = request.GET.get('name') branch = request.GET.get('branch') index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', common.DEFAULT_BUILD_SIZE)) builds = builds_helper.get_builds_and_tags(request, name=name, branch=branch, pageIndex=index, pageSize=size) scm_url = systems_helper.get_scm_url(request) current_build_id = request.GET.get('current_build_id', None) current_build = None if current_build_id: current_build = builds_helper.get_build_and_tag(request, current_build_id) html = render_to_string('builds/pick_a_build.tmpl', { "builds": builds, "current_build": current_build['build'], "scm_url": scm_url, "buildName": name, "branch": branch, "pageIndex": index, "pageSize": common.DEFAULT_BUILD_SIZE, "disablePrevious": index <= 1, "disableNext": len(builds) < common.DEFAULT_BUILD_SIZE, }) return HttpResponse(html)
def get_all_builds(request): name = request.GET.get('name') branch = request.GET.get('branch') index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', common.DEFAULT_BUILD_SIZE)) builds = builds_helper.get_builds_and_tags(request, name=name, branch=branch, pageIndex=index, pageSize=size) scm_url = systems_helper.get_scm_url(request) current_build_id = request.GET.get('current_build_id', None) current_build = None if current_build_id: current_build = builds_helper.get_build_and_tag( request, current_build_id) html = render_to_string( 'builds/pick_a_build.tmpl', { "builds": builds, "current_build": current_build['build'], "scm_url": scm_url, "buildName": name, "branch": branch, "pageIndex": index, "pageSize": common.DEFAULT_BUILD_SIZE, "disablePrevious": index <= 1, "disableNext": len(builds) < common.DEFAULT_BUILD_SIZE, }) return HttpResponse(html)
def list_builds(request, name): index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', common.DEFAULT_BUILD_SIZE)) builds = builds_helper.get_builds_and_tags(request, name=name, pageIndex=index, pageSize=size) return render(request, 'builds/builds.html', { 'build_name': name, 'builds': builds, "pageIndex": index, "pageSize": common.DEFAULT_BUILD_SIZE, "disablePrevious": index <= 1, "disableNext": len(builds) < common.DEFAULT_BUILD_SIZE, })
def list_builds(request, name): index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', common.DEFAULT_BUILD_SIZE)) builds = builds_helper.get_builds_and_tags(request, name=name, pageIndex=index, pageSize=size) return render( request, 'builds/builds.html', { 'build_name': name, 'builds': builds, "pageIndex": index, "pageSize": common.DEFAULT_BUILD_SIZE, "disablePrevious": index <= 1, "disableNext": len(builds) < common.DEFAULT_BUILD_SIZE, })
def deploy_commit(request, name, stage, commit): env = environs_helper.get_env_by_stage(request, name, stage) builds = builds_helper.get_builds_and_tags(request, commit=commit) current_build = None if env.get('deployId'): deploy = deploys_helper.get(request, env['deployId']) current_build = builds_helper.get_build(request, deploy['buildId']) scm_url = systems_helper.get_scm_url(request) html = render_to_string('deploys/deploy_build.html', { "env": env, "builds": builds, "current_build": current_build, "scm_url": scm_url, "buildName": env.get('buildName'), "branch": env.get('branch'), "csrf_token": get_token(request), }) return HttpResponse(html)
def get_builds(request, name, stage): env = environs_helper.get_env_by_stage(request, name, stage) env_promote = environs_helper.get_env_promotes_config(request, name, stage) show_lock = False if env_promote['type'] == 'AUTO' and env_promote['predStage'] and \ env_promote['predStage'] == environs_helper.BUILD_STAGE: show_lock = True if 'buildName' not in env and not env['buildName']: html = render_to_string('builds/simple_builds.tmpl', { "builds": [], "env": env, "show_lock": show_lock, }) return HttpResponse(html) current_publish_date = 0 if 'deployId' in env and env['deployId']: deploy = deploys_helper.get(request, env['deployId']) build = builds_helper.get_build(request, deploy['buildId']) current_publish_date = build['publishDate'] # return only the new builds index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', common.DEFAULT_BUILD_SIZE)) builds = builds_helper.get_builds_and_tags(request, name=env['buildName'], pageIndex=index, pageSize=size) new_builds = [] for build in builds: if build['build']['publishDate'] > current_publish_date: new_builds.append(build) html = render_to_string('builds/simple_builds.tmpl', { "builds": new_builds, "current_publish_date": current_publish_date, "env": env, "show_lock": show_lock, }) return HttpResponse(html)
def get_all_builds(request): name = request.GET.get('name') branch = request.GET.get('branch') index = int(request.GET.get('page_index', '1')) size = int(request.GET.get('page_size', common.DEFAULT_BUILD_SIZE)) builds = builds_helper.get_builds_and_tags(request, name=name, branch=branch, pageIndex=index, pageSize=size) scm_url = systems_helper.get_scm_url(request) deploy_state = None current_build_id = request.GET.get('current_build_id', None) override_policy = request.GET.get('override_policy') deploy_id = request.GET.get('deploy_id') current_build = None if current_build_id: current_build = builds_helper.get_build_and_tag( request, current_build_id) current_build = current_build.get('build') if deploy_id: deploy_config = deploys_helper.get(request, deploy_id) if deploy_config: deploy_state = deploy_config.get('state', None) html = render_to_string( 'builds/pick_a_build.tmpl', { "builds": builds, "current_build": current_build, "scm_url": scm_url, "buildName": name, "branch": branch, "pageIndex": index, "pageSize": common.DEFAULT_BUILD_SIZE, "disablePrevious": index <= 1, "disableNext": len(builds) < common.DEFAULT_BUILD_SIZE, "overridePolicy": override_policy, "deployState": deploy_state, }) return HttpResponse(html)
def search_commit(request, commit): builds = builds_helper.get_builds_and_tags(request, commit=commit) return render(request, 'builds/builds_by_commit.html', { 'commit': commit, 'builds': builds, })