diff --git a/.travis.yml b/.travis.yml index 20292abd5..b2770084c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/lib/travis/api/v3/renderer/build.rb b/lib/travis/api/v3/renderer/build.rb index d634b73b1..9b772004e 100644 --- a/lib/travis/api/v3/renderer/build.rb +++ b/lib/travis/api/v3/renderer/build.rb @@ -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]) @@ -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 @@ -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