Sha256: f62496b5a5dc35c342056d11920dce155f6c0013d7d60af00e1de78e1797a952

Contents?: true

Size: 720 Bytes

Versions: 6

Compression:

Stored size: 720 Bytes

Contents

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

    def create
      return redirect_to rollback_stack_deploy_path(@stack, @deploy) if !params[:force] && @stack.deploying?
      @rollback = @deploy.trigger_rollback(current_user, env: rollback_params[:env])
      redirect_to stack_deploy_path(@stack, @rollback)
    end

    private

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

    def load_deploy
      @deploy = @stack.deploys.find(rollback_params[:parent_id])
    end

    def rollback_params
      params.require(:rollback).permit(:parent_id, env: @stack.deploy_variables.map(&:name))
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shipit-engine-0.7.0 app/controllers/shipit/rollbacks_controller.rb
shipit-engine-0.6.4 app/controllers/shipit/rollbacks_controller.rb
shipit-engine-0.6.3 app/controllers/shipit/rollbacks_controller.rb
shipit-engine-0.6.2 app/controllers/shipit/rollbacks_controller.rb
shipit-engine-0.6.1 app/controllers/shipit/rollbacks_controller.rb
shipit-engine-0.6.0 app/controllers/shipit/rollbacks_controller.rb