gitlab-org--gitlab-foss/app/services/create_deployment_service.rb

19 lines
417 B
Ruby
Raw Normal View History

2016-06-10 17:36:54 -04:00
require_relative 'base_service'
class CreateDeploymentService < BaseService
2016-06-14 07:51:12 -04:00
def execute(deployable = nil)
2016-06-14 12:34:48 -04:00
environment = project.environments.find_or_create_by(
name: params[:environment]
)
2016-06-10 17:36:54 -04:00
2016-06-14 07:51:12 -04:00
project.deployments.create(
environment: environment,
ref: params[:ref],
tag: params[:tag],
sha: params[:sha],
user: current_user,
2016-06-14 12:34:48 -04:00
deployable: deployable
2016-06-14 07:51:12 -04:00
)
2016-06-10 17:36:54 -04:00
end
end