summaryrefslogtreecommitdiff
path: root/app/controllers/projects/builds_controller.rb
blob: 9bb1a9e14ed275d9d7d03002ec79909e28bc8b66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Projects::BuildsController < Projects::ApplicationController
  before_action :ci_project
  before_action :build

  layout "project"

  def show
    @builds = @ci_project.commits.find_by_sha(@build.sha).builds.order('id DESC')
    @builds = @builds.where("id not in (?)", @build.id).page(params[:page]).per(20)
    @commit = @build.commit

    respond_to do |format|
      format.html
      format.json do
        render json: @build.to_json(methods: :trace_html)
      end
    end
  end

  private

  def build
    @build ||= ci_project.builds.unscoped.find_by(id: params[:id])
  end
end