Commit 14f928b7 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add CI status badge implementation to commit controller

parent 01a406f5
...@@ -57,6 +57,12 @@ class Projects::CommitController < Projects::ApplicationController ...@@ -57,6 +57,12 @@ class Projects::CommitController < Projects::ApplicationController
render layout: false render layout: false
end end
def status
status_sha = ci_commit.sha if ci_commit
image = Ci::ImageForBuildService.new.execute(@project, sha: status_sha)
send_file(image.path, filename: image.name, disposition: 'inline', type: 'image/svg+xml')
end
private private
def commit def commit
......
...@@ -493,6 +493,13 @@ Rails.application.routes.draw do ...@@ -493,6 +493,13 @@ Rails.application.routes.draw do
constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }, constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
as: :commits as: :commits
) )
get(
'/status/*id/badge',
to: 'commit#status',
constraints: { format: /png/ },
as: :commit_status
)
end end
resource :avatar, only: [:show, :destroy] resource :avatar, only: [:show, :destroy]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment