diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-27 03:10:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-27 03:10:35 +0300 |
commit | 135dd0646bd1402985d82d99eb1e667a0f695e8b (patch) | |
tree | 7e062800b550e3ab36b8d8f9b1270c563aee6f2d /app/services/git | |
parent | f825fd1d881ce077ad868a70fd8d7db6a49e4700 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/git')
-rw-r--r-- | app/services/git/base_hooks_service.rb | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/app/services/git/base_hooks_service.rb b/app/services/git/base_hooks_service.rb index 269637805ad..968d45bbcdb 100644 --- a/app/services/git/base_hooks_service.rb +++ b/app/services/git/base_hooks_service.rb @@ -53,11 +53,11 @@ module Git def create_pipelines return unless params.fetch(:create_pipelines, true) - Ci::CreatePipelineService - .new(project, current_user, pipeline_params) - .execute!(:push, pipeline_options) - rescue Ci::CreatePipelineService::CreateError => ex - log_pipeline_errors(ex) + if ::Feature.enabled?(:refactored_create_pipeline_execution_method, project) + create_pipeline_refactored + else + create_pipeline_legacy + end end def execute_project_hooks @@ -148,14 +148,14 @@ module Git {} end - def log_pipeline_errors(exception) + def log_pipeline_errors(error_message) data = { class: self.class.name, correlation_id: Labkit::Correlation::CorrelationId.current_id.to_s, project_id: project.id, project_path: project.full_path, message: "Error creating pipeline", - errors: exception.to_s, + errors: error_message, pipeline_params: sanitized_pipeline_params } @@ -175,5 +175,21 @@ module Git Gitlab::IntegrationsLogger end end + + def create_pipeline_refactored + response = Ci::CreatePipelineService + .new(project, current_user, pipeline_params) + .execute(:push, **pipeline_options) + + log_pipeline_errors(response.message) unless response.payload.persisted? + end + + def create_pipeline_legacy + Ci::CreatePipelineService + .new(project, current_user, pipeline_params) + .execute!(:push, pipeline_options) + rescue Ci::CreatePipelineService::CreateError => ex + log_pipeline_errors(ex.to_s) # Stringifying the ex here as I removed stringifying in log_pipeline_errors. + end end end |