Skip to content
Snippets Groups Projects
Commit 4ef8a014 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

include git output to logs. make checkout of commit if

parent 9c4dc65a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -55,7 +55,7 @@ class ProjectsController < ApplicationController
@project = Project.find(params[:id])
@build = @project.register_build(ref: params[:ref])
 
if @build
if @build and @build.id
Resque.enqueue(Runner, @build.id)
redirect_to project_build_path(@project, @build)
else
Loading
Loading
Loading
Loading
@@ -23,15 +23,13 @@ class Runner
def run
path = project.path
commands = project.scripts
return if build.canceled?
commands = commands.lines.to_a
commands.unshift(prepare_project_cmd(path, build.sha))
 
build.run!
 
prepare_project(path, build.ref)
Dir.chdir(path) do
commands.each_line do |line|
commands.each do |line|
status = command(line, path)
build.write_trace(@output)
 
Loading
Loading
@@ -92,12 +90,12 @@ class Runner
@output << @tmp_file.read
end
 
def prepare_project(path, ref)
def prepare_project_cmd(path, ref)
cmd = []
cmd << "cd #{path}"
cmd << "git fetch"
cmd << "git reset --hard"
cmd << "git checkout origin/#{ref}"
`#{cmd.join("&&")}`
cmd << "git checkout #{ref}"
cmd.join(" && ")
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment