Class: InchCI::Worker::Project::BuildJSON::ShellInvocation

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/inch_ci/worker/project/build_json.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-from-json"

Instance Method Summary collapse

Instance Method Details

#perform(filename, url, branch_name = 'master', trigger = 'ci', build_id = 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.


53
54
55
56
57
58
59
60
# File 'lib/inch_ci/worker/project/build_json.rb', line 53

def perform(filename, url, branch_name = 'master', trigger = 'ci', build_id = nil)
  build = ensure_running_build(url, branch_name, trigger, build_id)
  if build.status == STATUS_RUNNING
    stdout_str, stderr_str, status = Open3.capture3("#{BIN} #{filename}")
    Project::Build::HandleWorkerOutput.new(stdout_str, stderr_str, build)
  end
  Gossip.update_build(build, build.project, build.branch)
end