Added build time showing

Fixed package downloading 503 error
master
Alexey Berezhok 6 days ago
parent 54bf61d301
commit f2136260c9

@ -980,8 +980,9 @@ get "/buildinfofraw" do
if params["file"].nil? || !File.exist?(params["file"])
print_error_page(503, "Файл не найден")
else
if !File.binary?(params["file"]) && params["file"].start_with?(File.join(Dir.pwd(), cfg.get_projects_path))
send_file params["file"]
if File.binary?(params["file"]) && params["file"].start_with?(File.join(Dir.pwd(), cfg.get_projects_path))
f_name = File.basename(params["file"])
send_file(params["file"], :filename => f_name, :type => "application/octet-stream", :disposition => 'attachment')
else
print_error_page(503, "Файл не может быть скачан")
end

@ -320,7 +320,7 @@ class DBase
end
def get_builds()
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id left join build_rpm as t4 on t4.build_id = t1.id group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id desc"].all
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, case when buildstart is null then 0 when buildstop is null then 0 else Cast((JulianDay(buildstop) - JulianDay(buildstart))*24*60*60 As Integer) end as timeproc, t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id left join build_rpm as t4 on t4.build_id = t1.id group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id desc"].all
end
def get_build_info(build_id)
@ -341,11 +341,11 @@ class DBase
end
def get_builds_for_project(prj_id)
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id left join build_rpm as t4 on t4.build_id = t1.id where t1.proj_id = ? group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id desc", prj_id.to_i].all
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, case when buildstart is null then 0 when buildstop is null then 0 else Cast((JulianDay(buildstop) - JulianDay(buildstart))*24*60*60 As Integer) end as timeproc,t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id left join build_rpm as t4 on t4.build_id = t1.id where t1.proj_id = ? group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id desc", prj_id.to_i].all
end
def get_builds_for_project_git(prj_id, git_id)
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id left join build_rpm as t4 on t4.build_id = t1.id where t1.proj_id = ? and t1.repo_id = ? group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id desc", prj_id.to_i, git_id.to_i].all
$DDB["select t1.id as buildid, t1.create_at as createat, t1.result as state, case when buildstart is null then 0 when buildstop is null then 0 else Cast((JulianDay(buildstop) - JulianDay(buildstart))*24*60*60 As Integer) end as timeproc ,t2.reponame as reponame, t2.id as gitid, t3.id as projid, t3.projname as prjname, count(*) as pkgcnt from buildtask as t1 join repos as t2 on t1.repo_id = t2.id join projects as t3 on t1.proj_id = t3.id left join build_rpm as t4 on t4.build_id = t1.id where t1.proj_id = ? and t1.repo_id = ? group by buildid, createat, state, reponame, projid, prjname, gitid order by t1.id desc", prj_id.to_i, git_id.to_i].all
end
def delete_git_from_project(prj_id, git_id)
@ -392,4 +392,12 @@ class DBase
def cancel_hang_builds()
BuildTask.where(result: [0, 3]).update(result: 4)
end
def update_build_task_begin_time(build_id)
BuildTask.where(id: build_id.to_i).update(buildstart: DateTime.now)
end
def update_build_task_end_time(build_id)
BuildTask.where(id: build_id.to_i).update(buildstop: DateTime.now)
end
end

@ -286,6 +286,7 @@ class MockManager
end
end
@db.update_build_task_status(@build_id, 0)
@db.update_build_task_begin_time(@build_id)
if @spec == ""
@error = true
@ -312,6 +313,7 @@ class MockManager
else
@db.update_build_task_status(@build_id, 2)
end
@db.update_build_task_end_time(@build_id)
global_lock.flock(File::LOCK_UN)
end

@ -0,0 +1,12 @@
require "sequel"
Sequel.migration do
change do
alter_table(:buildtask) do
add_column :buildstart, DateTime
add_column :buildstop, DateTime
set_column_allow_null :buildstart
set_column_allow_null :buildstop
end
end
end

@ -8,6 +8,7 @@
<th scope="col" class="text-center">git репозиторий</th>
<th scope="col" class="text-center">Дата сборки</th>
<th scope="col" class="text-center">Число собранных пакетов</th>
<th scope="col" class="text-center">Время сборки</th>
<th scope="col" class="text-center">Состояние</th>
<th scope="col" class="text-center">Перейти к сборке</th>
</tr>
@ -42,6 +43,7 @@
<td class="text-center"><a href="/prjgitf/<%= ERB::Util.url_encode(item[:projid]) %>/<%= ERB::Util.url_encode(item[:gitid]) %>"><%= item[:reponame] %></a></td>
<td class="text-center"><%= item[:createat] %></td>
<td class="text-center"><%= item[:pkgcnt] %></td>
<td class="text-center"><%= item[:timeproc] %> сек</td>
<td class="text-center <%= cl %>">
<%= st %>
</td>

@ -9,6 +9,7 @@
<th scope="col" class="text-center">git репозиторий</th>
<th scope="col" class="text-center">Дата сборки</th>
<th scope="col" class="text-center">Число собранных пакетов</th>
<th scope="col" class="text-center">Время сборки</th>
<th scope="col" class="text-center">Состояние</th>
<th scope="col" class="text-center">Перейти к сборке</th>
</tr>
@ -43,6 +44,7 @@
<td class="text-center"><a href="/prjgitf/<%= ERB::Util.url_encode(item[:projid]) %>/<%= ERB::Util.url_encode(item[:gitid]) %>"><%= item[:reponame] %></a></td>
<td class="text-center"><%= item[:createat] %></td>
<td class="text-center"><%= item[:pkgcnt] %></td>
<td class="text-center"><%= item[:timeproc] %> сек</td>
<td class="text-center <%= cl %>">
<%= st %>
</td>

@ -9,6 +9,7 @@
<th scope="col" class="text-center">git репозиторий</th>
<th scope="col" class="text-center">Дата сборки</th>
<th scope="col" class="text-center">Число собранных пакетов</th>
<th scope="col" class="text-center">Время сборки</th>
<th scope="col" class="text-center">Состояние</th>
<th scope="col" class="text-center">Перейти к сборке</th>
</tr>
@ -43,6 +44,7 @@
<td class="text-center"><a href="/prjgitf/<%= ERB::Util.url_encode(item[:projid]) %>/<%= ERB::Util.url_encode(item[:gitid]) %>"><%= item[:reponame] %></a></td>
<td class="text-center"><%= item[:createat] %></td>
<td class="text-center"><%= item[:pkgcnt] %></td>
<td class="text-center"><%= item[:timeproc] %> сек</td>
<td class="text-center <%= cl %>">
<%= st %>
</td>

Loading…
Cancel
Save