Sha256: 930e2881739e4859a73d11f2240304276e29dd1a71b076e97844dbf992df72fb

Contents?: true

Size: 931 Bytes

Versions: 7

Compression:

Stored size: 931 Bytes

Contents

# frozen_string_literal: true
module Shipit
  module Api
    class DeploysController < BaseController
      require_permission :deploy, :stack

      def index
        render_resources(stack.deploys_and_rollbacks)
      end

      params do
        requires :sha, String, length: { in: 6..40 }
        accepts :force, Boolean, default: false
        accepts :require_ci, Boolean, default: false
        accepts :env, Hash, default: {}
      end
      def create
        commit = stack.commits.by_sha(params.sha) || param_error!(:sha, 'Unknown revision')
        param_error!(:force, "Can't deploy a locked stack") if !params.force && stack.locked?
        param_error!(:require_ci, "Commit is not deployable") if params.require_ci && !commit.deployable?
        deploy = stack.trigger_deploy(commit, current_user, env: params.env, force: params.force)
        render_resource(deploy, status: :accepted)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shipit-engine-0.38.0 app/controllers/shipit/api/deploys_controller.rb
shipit-engine-0.37.0 app/controllers/shipit/api/deploys_controller.rb
shipit-engine-0.36.1 app/controllers/shipit/api/deploys_controller.rb
shipit-engine-0.36.0 app/controllers/shipit/api/deploys_controller.rb
shipit-engine-0.35.1 app/controllers/shipit/api/deploys_controller.rb
shipit-engine-0.35.0 app/controllers/shipit/api/deploys_controller.rb
shipit-engine-0.34.0 app/controllers/shipit/api/deploys_controller.rb