Class: InchCI::Worker::Project::Build::ShellInvocation

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/inch_ci/worker/project/build.rb

Overview

The ShellInvocation class spawns another shell in which the given repo is analysed. The executed script then returns a YAML formatted string which contains the “build data”.

Note: A new shell is spawned so that the resulting process has its

own cwd and Dir.chdir has not to be synchronized across worker
threads.

Constant Summary collapse

BIN =
"bundle exec inch_ci-worker build"

Instance Method Summary collapse

Instance Method Details

#perform(url, branch_name = 'master', revision_uid = nil, trigger = 'manual', build_id = nil, language = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


50
51
52
53
54
55
56
57
58
59
# File 'lib/inch_ci/worker/project/build.rb', line 50

def perform(url, branch_name = 'master', revision_uid = nil, trigger = 'manual', build_id = nil, language = nil)
  build = ensure_running_build(url, branch_name, trigger, build_id)
  if build.status == STATUS_RUNNING
    cmd = "#{BIN} #{url.inspect} #{branch_name} #{revision_uid}"
    cmd << " --language=#{language}" if language
    stdout_str, stderr_str, status = Open3.capture3(cmd)
    HandleWorkerOutput.new(stdout_str, stderr_str, build)
  end
  Gossip.update_build(build, build.project, build.branch)
end