class CodeBuildNotifier::BranchEntry

Public Instance Methods

update() { |updates| ... } click to toggle source

Creates entries in a partition key with hardcoded primary key. Within the partition key, there is one record for each github repo. The 'projects' field in that record is a Map data type, keyed off project code, containing the status of the last build for that code.

# File lib/codebuild-notifier/branch_entry.rb, line 26
def update
  updates = hash_to_dynamo_update(branch_entry).merge(
    key: { source_id: source_id, version_key: version_key }
  )
  yield updates if block_given?
  update_item(updates)
end

Private Instance Methods

branch_entry() click to toggle source
# File lib/codebuild-notifier/branch_entry.rb, line 34
        def branch_entry
  {
    branch_name: current_build.branch_name,
    build_id: current_build.build_id,
    commit_hash: source_id,
    git_repo_url: current_build.git_repo_url,
    source_ref: current_build.source_ref,
    status: current_build.status,
    timestamp: current_build.start_time.to_i
  }
end
source_id() click to toggle source
# File lib/codebuild-notifier/branch_entry.rb, line 46
        def source_id
  current_build.project_code
end
version_key() click to toggle source
# File lib/codebuild-notifier/branch_entry.rb, line 50
        def version_key
  Digest::MD5.hexdigest(current_build.source_ref)
end