diff --git a/Gemfile.lock b/Gemfile.lock index c3551b4e..ec8ac24c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,7 +50,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 96ee8c449ebe305c5c95633cea13eb88fe978abb + revision: fb39f8af5628444e2d7f5893a9f09fde7b0796e2 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -199,9 +199,9 @@ GEM httparty (0.11.0) multi_json (~> 1.0) multi_xml (>= 0.5.2) - httpclient (2.7.0.1) + httpclient (2.7.1) i18n (0.7.0) - ice_nine (0.11.1) + ice_nine (0.11.2) jemalloc (1.0.1) journey (1.0.4) json (1.8.3) diff --git a/lib/travis/api/v3/models/job.rb b/lib/travis/api/v3/models/job.rb index 852f515c..f8f9bfb4 100644 --- a/lib/travis/api/v3/models/job.rb +++ b/lib/travis/api/v3/models/job.rb @@ -2,12 +2,13 @@ module Travis::API::V3 class Models::Job < Model self.inheritance_column = :_type_disabled - + has_one :log, dependent: :destroy belongs_to :repository belongs_to :commit belongs_to :build, autosave: true, foreign_key: 'source_id' belongs_to :owner, polymorphic: true serialize :config + serialize :debug_options end end diff --git a/lib/travis/api/v3/permissions/job.rb b/lib/travis/api/v3/permissions/job.rb index 3055257e..b2193a50 100644 --- a/lib/travis/api/v3/permissions/job.rb +++ b/lib/travis/api/v3/permissions/job.rb @@ -9,5 +9,9 @@ module Travis::API::V3 def restart? write? end + + def debug? + write? + end end end diff --git a/lib/travis/api/v3/routes.rb b/lib/travis/api/v3/routes.rb index 4243edb4..f70fbacd 100644 --- a/lib/travis/api/v3/routes.rb +++ b/lib/travis/api/v3/routes.rb @@ -34,6 +34,7 @@ module Travis::API::V3 post :cancel, '/cancel' post :restart, '/restart' + post :debug, '/debug' end resource :organization do diff --git a/lib/travis/api/v3/services/job/debug.rb b/lib/travis/api/v3/services/job/debug.rb new file mode 100644 index 00000000..63c1939c --- /dev/null +++ b/lib/travis/api/v3/services/job/debug.rb @@ -0,0 +1,29 @@ +module Travis::API::V3 + class Services::Job::Debug < Service + params "quiet" + + attr_reader :job + + def run + raise LoginRequired unless access_control.logged_in? or access_control.full_access? + raise NotFound unless @job = find(:job) + raise WrongCredentials unless Travis.config.debug_tools_enabled or Travis::Features.active?(:debug_tools, job.repository) + access_control.permissions(job).debug! + + job.debug_options = debug_data + job.save! + + query.restart(access_control.user) + accepted(job: job, state_change: :created) + end + + def debug_data + { + stage: 'before_install', + previous_state: job.state, + created_by: access_control.user.login, + quiet: params["quiet"] || false + } + end + end +end diff --git a/spec/v3/services/job/debug_sepc.rb b/spec/v3/services/job/debug_sepc.rb new file mode 100644 index 00000000..03fe80fb --- /dev/null +++ b/spec/v3/services/job/debug_sepc.rb @@ -0,0 +1,70 @@ +require 'spec_helper' + +describe Travis::API::V3::Services::Job::Debug do + let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first } + let(:owner_type) { repo.owner_type.constantize } + let(:owner) { owner_type.find(repo.owner_id)} + let(:build) { repo.builds.last } + let(:jobs) { Travis::API::V3::Models::Build.find(build.id).jobs } + let(:job) { jobs.last } + + before { repo.requests.each(&:delete) } + + before do + Travis::Features.stubs(:owner_active?).returns(true) + @original_sidekiq = Sidekiq::Client + Sidekiq.send(:remove_const, :Client) # to avoid a warning + Sidekiq::Client = [] + + Travis.config.stubs(:debug_tools_enabled).returns true + end + + after do + Sidekiq.send(:remove_const, :Client) # to avoid a warning + Sidekiq::Client = @original_sidekiq + end + + describe "#run" do + context "when unauthenticated" do + before { post("/v3/job/#{job.id}/debug") } + example { expect(last_response.status).to be == 403 } + example { expect(JSON.load(body)).to be == { + "@type" => "error", + "error_type" => "login_required", + "error_message" => "login required" + }} + end + + context "when authenticated" do + let(:token) { Travis::Api::App::AccessToken.create(user: repo.owner, app_id: 1) } + let(:headers) {{ 'HTTP_AUTHORIZATION' => "token #{token}" }} + + context "without sufficient authorization" do + before { post("/v3/job/#{job.id}/debug", {}, headers) } + + example { expect(last_response.status).to be == 403 } + example { expect(JSON.load(body)).to include( + "@type" => "error", + "error_type" => "insufficient_access", + "error_message" => "operation requires debug access to job", + "resource_type" => "job", + )} + end + + context "with sufficient authorization" do + let(:params) {{}} + + before { Travis::API::V3::Models::Permission.create(repository: repo, user: repo.owner, push: true) } + before { post("/v3/job/#{job.id}/debug", {}, headers) } + + example { expect(last_response.status).to be == 202 } + + example { expect(job.reload.debug_options).to include( + stage: "before_install", + created_by: owner.login, + quiet: false + ) } + end + end + end +end \ No newline at end of file diff --git a/spec/v3/services/job/find_spec.rb b/spec/v3/services/job/find_spec.rb index bf366386..cc2e6967 100644 --- a/spec/v3/services/job/find_spec.rb +++ b/spec/v3/services/job/find_spec.rb @@ -23,7 +23,8 @@ describe Travis::API::V3::Services::Job::Find do "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => job.id, "number" => job.number, "state" => job.state, @@ -93,7 +94,8 @@ describe Travis::API::V3::Services::Job::Find do "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => job.id, "number" => job.number, "state" => job.state, diff --git a/spec/v3/services/jobs/find_spec.rb b/spec/v3/services/jobs/find_spec.rb index f7b4c851..12ffa4fa 100644 --- a/spec/v3/services/jobs/find_spec.rb +++ b/spec/v3/services/jobs/find_spec.rb @@ -21,7 +21,8 @@ describe Travis::API::V3::Services::Jobs::Find do "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[0].id, "number" => "#{jobs[0].number}", "state" => "configured", @@ -30,45 +31,46 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}}, + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}}, {"@type" => "job", "@href" => "/v3/job/#{jobs[1].id}", "@representation" => "standard", "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[1].id, "number" => "#{jobs[1].number}", "state" => "configured", @@ -77,45 +79,46 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}}, + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}}, {"@type" => "job", "@href" => "/v3/job/#{jobs[2].id}", "@representation" => "standard", "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[2].id, "number" => "#{jobs[2].number}", "state" => "configured", @@ -124,45 +127,46 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}}, + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}}, {"@type" => "job", "@href" => "/v3/job/#{jobs[3].id}", "@representation" => "standard", "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[3].id, "number" => "#{jobs[3].number}", "state" => "configured", @@ -171,38 +175,38 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}} + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}} ] } } @@ -227,7 +231,8 @@ describe Travis::API::V3::Services::Jobs::Find do "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[0].id, "number" => "#{jobs[0].number}", "state" => "configured", @@ -236,45 +241,46 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}}, + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}}, {"@type" => "job", "@href" => "/v3/job/#{jobs[1].id}", "@representation" => "standard", "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[1].id, "number" => "#{jobs[1].number}", "state" => "configured", @@ -283,45 +289,46 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}}, + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}}, {"@type" => "job", "@href" => "/v3/job/#{jobs[2].id}", "@representation" => "standard", "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[2].id, "number" => "#{jobs[2].number}", "state" => "configured", @@ -330,45 +337,46 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}}, + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}}, {"@type" => "job", "@href" => "/v3/job/#{jobs[3].id}", "@representation" => "standard", "@permissions" => { "read" => true, "cancel" => false, - "restart" => false }, + "restart" => false, + "debug" => false }, "id" => jobs[3].id, "number" => "#{jobs[3].number}", "state" => "configured", @@ -377,38 +385,38 @@ describe Travis::API::V3::Services::Jobs::Find do "build" => { "@type" => "build", "@href" => "/v3/build/#{build.id}", - "@representation"=> "minimal", - "id" => build.id, - "number" => build.number, - "state" => "configured", - "duration" => nil, - "event_type" => "push", - "previous_state" => "passed", - "started_at" => "2010-11-12T13:00:00Z", - "finished_at" => nil}, - "queue" => "builds.linux", - "repository" =>{ - "@type" => "repository", - "@href" => "/v3/repo/1", - "@representation"=>"minimal", - "id" => repo.id, + "@representation"=> "minimal", + "id" => build.id, + "number" => build.number, + "state" => "configured", + "duration" => nil, + "event_type" => "push", + "previous_state" => "passed", + "started_at" => "2010-11-12T13:00:00Z", + "finished_at" => nil}, + "queue" => "builds.linux", + "repository" =>{ + "@type" => "repository", + "@href" => "/v3/repo/1", + "@representation"=>"minimal", + "id" => repo.id, "name" => "minimal", - "slug" => "svenfuchs/minimal"}, - "commit" =>{ - "@type" => "commit", - "@representation"=> "minimal", - "id" => commit.id, - "sha" => commit.commit, - "ref" => commit.ref, - "message" => commit.message, - "compare_url" => commit.compare_url, - "committed_at" =>"2010-11-12T12:55:00Z"}, - "owner" =>{ - "@type" => "user", - "@href" => "/v3/user/1", - "@representation"=> "minimal", - "id" => 1, - "login" => "svenfuchs"}} + "slug" => "svenfuchs/minimal"}, + "commit" =>{ + "@type" => "commit", + "@representation"=> "minimal", + "id" => commit.id, + "sha" => commit.commit, + "ref" => commit.ref, + "message" => commit.message, + "compare_url" => commit.compare_url, + "committed_at" =>"2010-11-12T12:55:00Z"}, + "owner" =>{ + "@type" => "user", + "@href" => "/v3/user/1", + "@representation"=> "minimal", + "id" => 1, + "login" => "svenfuchs"}} ] } }