Sha256: a63233b4639515ccecb4d4f4c472841919de71a6da4fc6324bf7c5485af8ec14

Contents?: true

Size: 720 Bytes

Versions: 5

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true
module Shipit
  module Api
    class TasksController < BaseController
      require_permission :read, :stack
      require_permission :deploy, :stack, only: :trigger

      def index
        render_resources(stack.tasks)
      end

      def show
        render_resource(stack.tasks.find(params[:id]))
      end

      params do
        accepts :env, Hash, default: {}
      end
      def trigger
        render_resource(stack.trigger_task(params[:task_name], current_user, env: params.env), status: :accepted)
      rescue Shipit::Task::ConcurrentTaskRunning
        render(status: :conflict, json: {
          message: 'A task is already running.',
        })
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shipit-engine-0.35.1 app/controllers/shipit/api/tasks_controller.rb
shipit-engine-0.35.0 app/controllers/shipit/api/tasks_controller.rb
shipit-engine-0.34.0 app/controllers/shipit/api/tasks_controller.rb
shipit-engine-0.33.0 app/controllers/shipit/api/tasks_controller.rb
shipit-engine-0.32.0 app/controllers/shipit/api/tasks_controller.rb