|
|
|
@ -36,13 +36,13 @@ logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
def index(request):
|
|
|
|
|
context = {}
|
|
|
|
|
return render(request, 'release_dashboard/index.html', context)
|
|
|
|
|
return render(request, "release_dashboard/index.html", context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
|
@require_http_methods(["POST", ])
|
|
|
|
|
@require_http_methods(["POST"])
|
|
|
|
|
def hotfix_build(request, branch, project):
|
|
|
|
|
if project not in rd_settings['projects']:
|
|
|
|
|
if project not in rd_settings["projects"]:
|
|
|
|
|
error = "repo:%s not valid" % project
|
|
|
|
|
logger.error(error)
|
|
|
|
|
return HttpResponseNotFound(error)
|
|
|
|
@ -58,158 +58,139 @@ def hotfix_build(request, branch, project):
|
|
|
|
|
logger.error(error)
|
|
|
|
|
return HttpResponseNotFound(error)
|
|
|
|
|
|
|
|
|
|
json_data = json.loads(request.body.decode('utf-8'))
|
|
|
|
|
if json_data['push'] == 'no':
|
|
|
|
|
json_data = json.loads(request.body.decode("utf-8"))
|
|
|
|
|
if json_data["push"] == "no":
|
|
|
|
|
logger.warn("dryrun for %s:%s", project, branch)
|
|
|
|
|
url = build.trigger_hotfix(project, branch, json_data['push'])
|
|
|
|
|
return JsonResponse({'url': url})
|
|
|
|
|
url = build.trigger_hotfix(project, branch, json_data["push"])
|
|
|
|
|
return JsonResponse({"url": url})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _build_logic(form, projects):
|
|
|
|
|
version_release = form.cleaned_data['version_release']
|
|
|
|
|
distribution = form.cleaned_data['distribution']
|
|
|
|
|
version_release = form.cleaned_data["version_release"]
|
|
|
|
|
distribution = form.cleaned_data["distribution"]
|
|
|
|
|
result = _hash_versions(form.cleaned_data, projects)
|
|
|
|
|
context = {'projects': [], 'release': version_release}
|
|
|
|
|
context = {"projects": [], "release": version_release}
|
|
|
|
|
flow_uuid = uuid.uuid4()
|
|
|
|
|
msg = "trying to trigger release %s, project %s"
|
|
|
|
|
for pro in projects:
|
|
|
|
|
try:
|
|
|
|
|
logger.debug(
|
|
|
|
|
"trying to trigger release %s, project %s",
|
|
|
|
|
version_release, pro)
|
|
|
|
|
url = build.trigger_build("%s-get-code" % pro,
|
|
|
|
|
version_release, result[pro],
|
|
|
|
|
distribution, flow_uuid)
|
|
|
|
|
context['projects'].append(
|
|
|
|
|
{'name': pro, 'url': url})
|
|
|
|
|
logger.debug(msg, version_release, pro)
|
|
|
|
|
url = build.trigger_build(
|
|
|
|
|
"%s-get-code" % pro,
|
|
|
|
|
version_release,
|
|
|
|
|
result[pro],
|
|
|
|
|
distribution,
|
|
|
|
|
flow_uuid,
|
|
|
|
|
)
|
|
|
|
|
context["projects"].append({"name": pro, "url": url})
|
|
|
|
|
except KeyError:
|
|
|
|
|
logger.error("Houston, we have a problem with"
|
|
|
|
|
"trigger for %s", pro)
|
|
|
|
|
context['projects'].append(
|
|
|
|
|
{'name': pro, 'url': None})
|
|
|
|
|
msg = "Houston, we have a problem with trigger for %s"
|
|
|
|
|
logger.error(msg, pro)
|
|
|
|
|
context["projects"].append({"name": pro, "url": None})
|
|
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
|
def build_deps(request, tag_only=False):
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
form = BuildDepForm(request.POST)
|
|
|
|
|
if form.is_valid():
|
|
|
|
|
context = _build_logic(form, rd_settings['build_deps'])
|
|
|
|
|
context = _build_logic(form, rd_settings["build_deps"])
|
|
|
|
|
else:
|
|
|
|
|
context = {'error': 'form validation error'}
|
|
|
|
|
return render(request, 'release_dashboard/build_result.html', context)
|
|
|
|
|
context = {"error": "form validation error"}
|
|
|
|
|
return render(request, "release_dashboard/build_result.html", context)
|
|
|
|
|
else:
|
|
|
|
|
context = {
|
|
|
|
|
'projects': _projects_versions(
|
|
|
|
|
rd_settings['build_deps'],
|
|
|
|
|
regex_mr,
|
|
|
|
|
True,
|
|
|
|
|
not tag_only,
|
|
|
|
|
"projects": _projects_versions(
|
|
|
|
|
rd_settings["build_deps"], regex_mr, True, not tag_only,
|
|
|
|
|
),
|
|
|
|
|
'debian': rd_settings['debian_supported'],
|
|
|
|
|
"debian": rd_settings["debian_supported"],
|
|
|
|
|
}
|
|
|
|
|
_common_versions(context, True, not tag_only)
|
|
|
|
|
return render(request, 'release_dashboard/build_deps.html', context)
|
|
|
|
|
return render(request, "release_dashboard/build_deps.html", context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
|
def hotfix(request):
|
|
|
|
|
context = {
|
|
|
|
|
'projects': _projects_versions(
|
|
|
|
|
rd_settings['projects'],
|
|
|
|
|
regex_hotfix,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
return render(request, 'release_dashboard/hotfix.html', context)
|
|
|
|
|
prj_list = _projects_versions(rd_settings["projects"], regex_hotfix)
|
|
|
|
|
context = {"projects": prj_list}
|
|
|
|
|
return render(request, "release_dashboard/hotfix.html", context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
|
def build_release(request, tag_only=False):
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
form = BuildReleaseForm(request.POST)
|
|
|
|
|
if form.is_valid():
|
|
|
|
|
context = _build_logic(form, rd_settings['projects'])
|
|
|
|
|
context = _build_logic(form, rd_settings["projects"])
|
|
|
|
|
else:
|
|
|
|
|
context = {'error': 'form validation error'}
|
|
|
|
|
return render(request, 'release_dashboard/build_result.html', context)
|
|
|
|
|
context = {"error": "form validation error"}
|
|
|
|
|
return render(request, "release_dashboard/build_result.html", context)
|
|
|
|
|
else:
|
|
|
|
|
context = {
|
|
|
|
|
'projects': _projects_versions(
|
|
|
|
|
rd_settings['projects'],
|
|
|
|
|
regex_mr,
|
|
|
|
|
True,
|
|
|
|
|
not tag_only,
|
|
|
|
|
"projects": _projects_versions(
|
|
|
|
|
rd_settings["projects"], regex_mr, True, not tag_only,
|
|
|
|
|
),
|
|
|
|
|
'debian': rd_settings['debian_supported'],
|
|
|
|
|
"debian": rd_settings["debian_supported"],
|
|
|
|
|
}
|
|
|
|
|
_common_versions(context, True, not tag_only)
|
|
|
|
|
if tag_only:
|
|
|
|
|
return render(request, 'release_dashboard/build_tag.html', context)
|
|
|
|
|
return render(request, 'release_dashboard/build.html', context)
|
|
|
|
|
return render(request, "release_dashboard/build_tag.html", context)
|
|
|
|
|
return render(request, "release_dashboard/build.html", context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
|
def refresh_all(request):
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
res = gerrit_fetch_all.delay()
|
|
|
|
|
return JsonResponse({'url': '/flower/task/%s' % res.id})
|
|
|
|
|
return JsonResponse({"url": "/flower/task/%s" % res.id})
|
|
|
|
|
else:
|
|
|
|
|
template = "release_dashboard/refresh.html"
|
|
|
|
|
projects = []
|
|
|
|
|
for project in rd_settings['projects']:
|
|
|
|
|
info = {
|
|
|
|
|
'name': project,
|
|
|
|
|
'tags': None
|
|
|
|
|
}
|
|
|
|
|
for project in rd_settings["projects"]:
|
|
|
|
|
info = {"name": project, "tags": None}
|
|
|
|
|
projects.append(info)
|
|
|
|
|
return render(request, 'release_dashboard/refresh.html',
|
|
|
|
|
{'projects': projects})
|
|
|
|
|
return render(request, template, {"projects": projects})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@require_http_methods(["POST", ])
|
|
|
|
|
@require_http_methods(["POST"])
|
|
|
|
|
def refresh(request, project):
|
|
|
|
|
res = gerrit_fetch_info.delay(project)
|
|
|
|
|
return JsonResponse({'url': '/flower/task/%s' % res.id})
|
|
|
|
|
return JsonResponse({"url": "/flower/task/%s" % res.id})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
|
def build_trunk_deps(request):
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
form = BuildTrunkDepForm(request.POST)
|
|
|
|
|
if form.is_valid():
|
|
|
|
|
context = _build_logic(form, rd_settings['build_deps'])
|
|
|
|
|
context = _build_logic(form, rd_settings["build_deps"])
|
|
|
|
|
else:
|
|
|
|
|
context = {'error': 'form validation error'}
|
|
|
|
|
return render(request, 'release_dashboard/build_result.html', context)
|
|
|
|
|
context = {"error": "form validation error"}
|
|
|
|
|
return render(request, "release_dashboard/build_result.html", context)
|
|
|
|
|
else:
|
|
|
|
|
template = "release_dashboard/build_trunk_deps.html"
|
|
|
|
|
context = {
|
|
|
|
|
'projects': _projects_versions(
|
|
|
|
|
trunk_build_deps,
|
|
|
|
|
regex_master,
|
|
|
|
|
),
|
|
|
|
|
'common_versions': {
|
|
|
|
|
'tags': [],
|
|
|
|
|
'branches': ['master', ]
|
|
|
|
|
},
|
|
|
|
|
'debian': rd_settings['debian_supported'],
|
|
|
|
|
"projects": _projects_versions(trunk_build_deps, regex_master,),
|
|
|
|
|
"common_versions": {"tags": [], "branches": ["master"]},
|
|
|
|
|
"debian": rd_settings["debian_supported"],
|
|
|
|
|
}
|
|
|
|
|
return render(request,
|
|
|
|
|
'release_dashboard/build_trunk_deps.html', context)
|
|
|
|
|
return render(request, template, context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
|
def build_trunk_release(request):
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
form = BuildTrunkReleaseForm(request.POST)
|
|
|
|
|
if form.is_valid():
|
|
|
|
|
context = _build_logic(form, trunk_projects)
|
|
|
|
|
else:
|
|
|
|
|
context = {'error': 'form validation error'}
|
|
|
|
|
return render(request, 'release_dashboard/build_result.html', context)
|
|
|
|
|
context = {"error": "form validation error"}
|
|
|
|
|
return render(request, "release_dashboard/build_result.html", context)
|
|
|
|
|
else:
|
|
|
|
|
context = {
|
|
|
|
|
'projects': _projects_versions(
|
|
|
|
|
trunk_projects,
|
|
|
|
|
regex_master,
|
|
|
|
|
),
|
|
|
|
|
'common_versions': {
|
|
|
|
|
'tags': [],
|
|
|
|
|
'branches': ['master', ]
|
|
|
|
|
},
|
|
|
|
|
'debian': rd_settings['debian_supported'],
|
|
|
|
|
"projects": _projects_versions(trunk_projects, regex_master,),
|
|
|
|
|
"common_versions": {"tags": [], "branches": ["master"]},
|
|
|
|
|
"debian": rd_settings["debian_supported"],
|
|
|
|
|
}
|
|
|
|
|
return render(request, 'release_dashboard/build_trunk.html', context)
|
|
|
|
|
return render(request, "release_dashboard/build_trunk.html", context)
|
|
|
|
|