Added mock build. Part 4
This commit is contained in:
@@ -24,6 +24,9 @@ end
|
||||
class ProjectsProjects < Sequel::Model(:projects_projects)
|
||||
end
|
||||
|
||||
class BuildTask < Sequel::Model(:buildtask)
|
||||
end
|
||||
|
||||
class DBase
|
||||
attr :error, :last_id
|
||||
|
||||
@@ -216,4 +219,23 @@ class DBase
|
||||
end
|
||||
res
|
||||
end
|
||||
|
||||
#result = 0 (in progress), 1 (stopped - error), 2 (stopped - success)
|
||||
def create_build_task(prj_id, git_id, proj_path)
|
||||
id = BuildTask.insert(repo_id: git_id.to_i, proj_id: prj_id.to_i, signpath: "", logpath: "", errlogpath: "", result: 0)
|
||||
@last_id = id
|
||||
BuildTask.where(id: id).update(logpath: File.join(proj_path, "#{id}"))
|
||||
end
|
||||
|
||||
def update_build_task_status(build_id, status)
|
||||
BuildTask.where(id: build_id.to_i).update(result: status.to_i)
|
||||
end
|
||||
|
||||
def update_build_task_error_log(build_id, path)
|
||||
BuildTask.where(id: build_id.to_i).update(errlogpath: path)
|
||||
end
|
||||
|
||||
def get_build_task_process_log(build_id)
|
||||
BuildTask.where(id: build_id.to_i).first
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user