Module: InchCI::Worker::Project::Build

Defined in:
lib/inch_ci/worker/project/build.rb,
lib/inch_ci/worker/project/build/calculate_diff.rb,
lib/inch_ci/worker/project/build/generate_badge.rb,
lib/inch_ci/worker/project/build/save_build_data.rb,
lib/inch_ci/worker/project/build/handle_worker_output.rb

Overview

The Build worker is responsible for “building” projects, i.e. cloning and analysing repos, by utilizing a gem called “inch_ci-worker”.

Defined Under Namespace

Classes: CalculateDiff, GenerateBadge, HandleWorkerOutput, SaveBuildData, ShellInvocation

Class Method Summary collapse

Class Method Details

.enqueue(url, branch_name = 'master', revision_uid = nil, trigger = 'manual') ⇒ Build

Parameters:

  • url (String)
  • branch_name (String) (defaults to: 'master')
  • revision_uid (String) (defaults to: nil)
  • trigger (String) (defaults to: 'manual')

Returns:


21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/inch_ci/worker/project/build.rb', line 21

def self.enqueue(url, branch_name = 'master', revision_uid = nil, trigger = 'manual')
  branch = Store::EnsureProjectAndBranch.call(url, branch_name)
  project = branch.project

  scheduled_builds = Store::FindScheduledBuildsInBranch.call(branch)
  scheduled_builds.each do |build|
    Store::UpdateBuildStatus.call(build, STATUS_CANCELLED)
  end

  build = Store::CreateBuild.call(branch, trigger)
  Gossip.new_build(build, build.project, build.branch)
  ShellInvocation.perform_async(url, branch_name, revision_uid, trigger, build.id, project.language)
  build
end