Sha256: ae710981b3a8b3558b7268467628ff36a807ad36082ac539b9a0554f12c38334

Contents?: true

Size: 942 Bytes

Versions: 3

Compression:

Stored size: 942 Bytes

Contents

module Shipit
  class ReleaseStatusesController < ShipitController
    before_action :load_stack
    before_action :load_deploy

    def create
      case params[:status]
      when 'success'
        @deploy.append_release_status(
          'success',
          "@#{current_user.login} signaled this release as healthy.",
          user: current_user,
        )
      when 'failure'
        @deploy.append_release_status(
          'failure',
          "@#{current_user.login} signaled this release as faulty.",
          user: current_user,
        )
      else
        render status: :unprocessable_entity, json: {message: "Invalid `status` parameter"}
      end
      render status: :created, json: @deploy.last_release_status
    end

    private

    def load_deploy
      @deploy = @stack.deploys_and_rollbacks.find(params[:deploy_id])
    end

    def load_stack
      @stack ||= Stack.from_param!(params[:stack_id])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shipit-engine-0.26.0 app/controllers/shipit/release_statuses_controller.rb
shipit-engine-0.25.1 app/controllers/shipit/release_statuses_controller.rb
shipit-engine-0.25.0 app/controllers/shipit/release_statuses_controller.rb