Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ before_install:
- 'gem install rubygems-update -v 3.4.22'
- 'gem update --system'

install:
- bundle install --jobs=3 --retry=3

jobs:
include:
- stage: ":ship: it to Quay.io"
Expand Down
22 changes: 20 additions & 2 deletions lib/travis/api/v3/renderer/build.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Travis::API::V3
class Renderer::Build < ModelRenderer
representation(:minimal, :id, :number, :state, :duration, :event_type, :previous_state, :pull_request_title, :pull_request_number, :started_at, :finished_at, :private, :priority)
representation(:list, *representations[:minimal], :branch, :tag, :commit, :request, :created_by)
representation(:standard, *representations[:minimal], :repository, :branch, :tag, :commit, :jobs, :stages, :created_by, :updated_at)
representation(:active, *representations[:standard])

Expand All @@ -13,7 +14,11 @@ def self.available_attributes
end

def request
model.request
if representation?(:list)
Renderer.render_model(model.request, mode: :minimal)
else
model.request
end
end

def jobs
Expand All @@ -25,7 +30,20 @@ def jobs
end

def branch
V3::Models::Branch.find_by(repository_id: repository.id, name: model[:branch])
return unless model[:branch]

branch_model = V3::Models::Branch.find_by(
repository_id: repository.id,
name: model[:branch]
)
return unless branch_model

if representation?(:list)
# Pre-render to minimal so include=build.branch can’t force it to standard
Renderer.render_model(branch_model, mode: :minimal)
else
branch_model
end
end

def created_by
Expand Down