diff options
author | Raphael Tweitmann <r.tweity@gmx.de> | 2019-06-17 12:00:51 +0000 |
---|---|---|
committer | Fabio Pitino <fpitino@gitlab.com> | 2019-06-21 15:21:16 +0100 |
commit | a39277a4f9cd11029601bf863e09a127f8e82291 (patch) | |
tree | 610b5a4e79258a1dc9660fc0585d6af1fde9149f /app/models/project_services/drone_ci_service.rb | |
parent | 5f1038c8886ceb0e3879f29a074af7d4c6cb6171 (diff) | |
download | gitlab-ce-a39277a4f9cd11029601bf863e09a127f8e82291.tar.gz |
Extract common validations from ci services
DroneCI and TeamCity shared the same validations methods
on the data received. These validations were extracted
into a concern
Diffstat (limited to 'app/models/project_services/drone_ci_service.rb')
-rw-r--r-- | app/models/project_services/drone_ci_service.rb | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/app/models/project_services/drone_ci_service.rb b/app/models/project_services/drone_ci_service.rb index 5ccc2f019cb..dbdc8345c93 100644 --- a/app/models/project_services/drone_ci_service.rb +++ b/app/models/project_services/drone_ci_service.rb @@ -2,6 +2,7 @@ class DroneCiService < CiService include ReactiveService + include ServicePushDataValidations prop_accessor :drone_url, :token boolean_accessor :enable_ssl_verification @@ -96,23 +97,4 @@ class DroneCiService < CiService { type: 'checkbox', name: 'enable_ssl_verification', title: "Enable SSL verification" } ] end - - private - - def tag_push_valid?(data) - data[:total_commits_count] > 0 && !Gitlab::Git.blank_ref?(data[:after]) - end - - def push_valid?(data) - opened_merge_requests = project.merge_requests.opened.where(source_project_id: project.id, - source_branch: Gitlab::Git.ref_name(data[:ref])) - - opened_merge_requests.empty? && data[:total_commits_count] > 0 && - !Gitlab::Git.blank_ref?(data[:after]) - end - - def merge_request_valid?(data) - data[:object_attributes][:state] == 'opened' && - MergeRequest.state_machines[:merge_status].check_state?(data[:object_attributes][:merge_status]) - end end |