Add CI status badge implementation to commit controller
This commit is contained in:
parent
01a406f5b0
commit
14f928b730
|
@ -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
|
||||||
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]
|
||||||
|
|
Loading…
Reference in New Issue