Sha256: 7805da2b06d2c3bedfc2b9c7118257ea85b5a893a90b31fcdd7b903527c4505f

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

class TestRunsController < ApplicationController
  before_filter :find_test_run
  skip_before_filter :verify_authenticity_token, only: [:save_results]

  def show
    @title = "Test Results for #{@test_run.sha[0...8]}"
    render template: "project_notification/test_run"
  end

  def confirm_retry
  end

  def retry
    @test_run.retry!

    build_url = if @project.ci_server.respond_to? :last_build_progress_url
      @project.ci_server.last_build_progress_url
    elsif @project.ci_server.respond_to? :last_build_url
      @project.ci_server.last_build_url
    end

    if build_url
      redirect_to build_url
    else
      redirect_to root_url, notice: "Build for #{@project.name} retried"
    end
  end

  def save_results
    results_url = params[:results_url]

    if results_url.blank?
      message = "#{@project.ci_server_name} is not appropriately configured to build #{@project.name}."
      additional_info = "#{@project.ci_server_name} did not supply 'results_url' when it triggered the post_build hook"
      ProjectNotification.ci_configuration_error(@test_run, message, additional_info: additional_info).deliver!
      return
    end

    @test_run.completed!(results_url)
    head :ok
  end

private

  def find_test_run
    @project = Project.find_by_slug!(params[:slug])
    @test_run = @project.test_runs.find_by_sha!(params[:commit])
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
houston-core-0.7.0.beta3 app/controllers/test_runs_controller.rb
houston-core-0.7.0.beta2 app/controllers/test_runs_controller.rb
houston-core-0.7.0.beta app/controllers/test_runs_controller.rb
houston-core-0.6.3 app/controllers/test_runs_controller.rb
houston-core-0.6.2 app/controllers/test_runs_controller.rb
houston-core-0.6.1 app/controllers/test_runs_controller.rb