summaryrefslogtreecommitdiff
path: root/app/services/create_deployment_service.rb
blob: efeb9df9527f6263aea1c40e76f8bb24dc20f89a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require_relative 'base_service'

class CreateDeploymentService < BaseService
  def execute(deployable = nil)
    environment = project.environments.find_or_create_by(
      name: params[:environment]
    )

    project.deployments.create(
      environment: environment,
      ref: params[:ref],
      tag: params[:tag],
      sha: params[:sha],
      user: current_user,
      deployable: deployable
    )
  end
end