forked from openSUSE/open-build-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tag_push.rb
21 lines (21 loc) · 1.07 KB
/
tag_push.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# This class is used in TriggerControllerService::ScmExtractor to handle tag push events coming from Gitlab.
class GitlabPayload::TagPush < GitlabPayload
def payload
default_payload.merge( # We need this for Workflow::Step#target_package_name
event: 'Tag Push Hook',
tag_name: webhook_payload[:ref].sub('refs/tags/', ''),
# We need this for Workflows::YAMLDownloader#download_url
# This will contain a commit SHA
target_branch: webhook_payload[:after],
# We need this for Workflows::YAMLDownloader#download_url
path_with_namespace: webhook_payload.dig(:project, :path_with_namespace),
source_repository_full_name: webhook_payload.dig(:project, :path_with_namespace),
target_repository_full_name: webhook_payload.dig(:project, :path_with_namespace),
# We need this for SCMWebhookEventValidator#valid_push_event
ref: webhook_payload[:ref],
# We need this for Workflow::Step#branch_request_content_{github,gitlab}
commit_sha: webhook_payload[:after],
project_id: webhook_payload[:project_id]
)
end
end