diff --git a/app/services/git/branch_push_service.rb b/app/services/git/branch_push_service.rb index b55aeb5f2b91743200c8049b1bc6b960bf71ccff..a5113300f5d26f0064ad657906ad082b042a03e0 100644 --- a/app/services/git/branch_push_service.rb +++ b/app/services/git/branch_push_service.rb @@ -142,7 +142,11 @@ module Git .perform_async(project.id, current_user.id, params[:oldrev], params[:newrev], params[:ref]) EventCreateService.new.push(project, current_user, build_push_data) - Ci::CreatePipelineService.new(project, current_user, build_push_data).execute(:push, pipeline_options) + + if params.fetch(:create_pipelines, true) + Ci::CreatePipelineService.new(project, current_user, build_push_data) + .execute(:push, pipeline_options) + end project.execute_hooks(build_push_data.dup, :push_hooks) project.execute_services(build_push_data.dup, :push_hooks) diff --git a/app/services/git/tag_push_service.rb b/app/services/git/tag_push_service.rb index 9ce0fbdb206bd242c2f96c70b70c0e635e07b12a..ddf1a2d04fc0b94d2c20fbdcd62e47edd398515f 100644 --- a/app/services/git/tag_push_service.rb +++ b/app/services/git/tag_push_service.rb @@ -11,7 +11,11 @@ module Git @push_data = build_push_data EventCreateService.new.push(project, current_user, push_data) - Ci::CreatePipelineService.new(project, current_user, push_data).execute(:push, pipeline_options) + + if params.fetch(:create_pipelines, true) + Ci::CreatePipelineService.new(project, current_user, push_data) + .execute(:push, pipeline_options) + end project.execute_hooks(push_data.dup, :tag_push_hooks) project.execute_services(push_data.dup, :tag_push_hooks) diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index d269bc952015c7d094e48b964329719b01df10eb..7c39877be067f0d80b7cc77fa9d36b9f4a104b50 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -97,6 +97,7 @@ describe PostReceive do 123456 789012 refs/heads/feature2 123458 789013 refs/heads/feature3 123459 789015 refs/heads/feature4 + 654321 210987 refs/tags/tag2 EOF end