Skip to content
Snippets Groups Projects
Commit 979c04e6 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Add 'last_build' informations to commits list/details in API

parent 2c1f8e2d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -211,6 +211,12 @@ class Commit
project.ci_commit(sha)
end
 
def last_build
commit = ci_commit
return unless commit
commit.builds.order('id DESC').first
end
def status
ci_commit.try(:status) || :not_found
end
Loading
Loading
Loading
Loading
@@ -126,14 +126,35 @@ module API
end
end
 
class RepoCommitBuild < Grape::Entity
expose :id
expose :name
expose :description
expose :stage
expose :coverage
expose :status
expose :allow_failure
expose :deploy
expose :created_at
expose :started_at
expose :finished_at
expose :target_url
end
class RepoCommitDetailBuild < RepoCommitBuild
expose :commands
end
class RepoCommit < Grape::Entity
expose :id, :short_id, :title, :author_name, :author_email, :created_at
expose :safe_message, as: :message
expose :last_build, with: Entities::RepoCommitBuild
end
 
class RepoCommitDetail < RepoCommit
expose :parent_ids, :committed_date, :authored_date
expose :status
expose :last_build, with: Entities::RepoCommitDetailBuild
end
 
class ProjectSnippet < Grape::Entity
Loading
Loading
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