Skip to content
Snippets Groups Projects

Add API for manually creating deployments

Merged Yorick Peterse requested to merge deployments-api into master
2 unresolved threads
18 files
+ 489
93
Compare changes
  • Side-by-side
  • Inline
Files
18
  • e2a3f552
    This API can be used for manually creating deployments, instead of being
    limited to creating deployments using CI pipelines.
    
    As part of these changes, I refactored some parts of the existing
    deployments code. This ensures we reuse the same logic for creating
    deployments in different places. We also move the deployments service
    classes to a Deployments namespace, now that there are two service
    classes.
@@ -13,19 +13,14 @@ def create_deployment
name: expanded_environment_name
)
# If we failed to persist envirionment record by validation error, such as name with invalid character,
# the job will fall back to a non-environment job.
# If we failed to persist envirionment record by validation error, such as
# name with invalid character, the job will fall back to a non-environment
# job.
return unless environment.persisted?
create_deployment!(
cluster_id: environment.deployment_platform&.cluster_id,
project_id: environment.project_id,
environment: environment,
ref: ref,
tag: tag,
sha: sha,
user: user,
on_stop: on_stop)
Deployments::CreateService
.new(environment, user, ref: ref, tag: tag, sha: sha, on_stop: on_stop)
.create_deployment_for_deployable!(self)
end
end
end
Loading