Class: Integrations::Buildkite
Constant Summary
collapse
- ENDPOINT =
"https://buildkite.com"
Integrations::Base::Integration::BASE_ATTRIBUTES, Integrations::Base::Integration::BASE_CLASSES, Integrations::Base::Integration::DEV_INTEGRATION_NAMES, Integrations::Base::Integration::INSTANCE_LEVEL_ONLY_INTEGRATION_NAMES, Integrations::Base::Integration::INTEGRATION_NAMES, Integrations::Base::Integration::PROJECT_AND_GROUP_LEVEL_ONLY_INTEGRATION_NAMES, Integrations::Base::Integration::PROJECT_LEVEL_ONLY_INTEGRATION_NAMES, Integrations::Base::Integration::SECTION_TYPE_CONFIGURATION, Integrations::Base::Integration::SECTION_TYPE_CONNECTION, Integrations::Base::Integration::SECTION_TYPE_TRIGGER, Integrations::Base::Integration::SNOWPLOW_EVENT_ACTION, Integrations::Base::Integration::SNOWPLOW_EVENT_LABEL, Integrations::Base::Integration::UnknownType
ApplicationRecord::MAX_PLUCK
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
ResetOnColumnErrors::MAX_RESET_PERIOD
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from HasAvatar
#avatar_url
Methods included from HasWebHook
#execute_web_hook!, #hook_ssl_verification, #update_web_hook!
#valid_token?
#activate!, #activate_disabled_reason, #activated?, #api_field_names, #async_execute, #attributes, #attribution_notice, #category, #chat?, #ci?, #configurable_events, #deactivate!, #default_test_event, #description, #dup, #editable?, #event_channel_names, #event_names, #fields, #form_fields, #group_level?, #help, #inheritable?, #initialize_properties, #instance_level?, #json_fields, #manual_activation?, #operating?, #parent, #project_level?, #reencrypt_properties, #reset_updated_properties, #secret_fields, #sections, #supported_events, #supports_data_fields?, #test, #testable?, #title, #to_database_hash, #to_param, #toggle!, #updated_properties
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#reset_on_union_error, #reset_on_unknown_attribute_error
#serializable_hash
Class Method Details
.description ⇒ Object
91
92
93
|
# File 'app/models/integrations/buildkite.rb', line 91
def self.description
'Run CI/CD pipelines with Buildkite.'
end
|
.help ⇒ Object
95
96
97
|
# File 'app/models/integrations/buildkite.rb', line 95
def self.help
s_('ProjectService|Run CI/CD pipelines with Buildkite.')
end
|
.supported_events ⇒ Object
40
41
42
|
# File 'app/models/integrations/buildkite.rb', line 40
def self.supported_events
%w[push merge_request tag_push]
end
|
.title ⇒ Object
87
88
89
|
# File 'app/models/integrations/buildkite.rb', line 87
def self.title
'Buildkite'
end
|
.to_param ⇒ Object
99
100
101
|
# File 'app/models/integrations/buildkite.rb', line 99
def self.to_param
'buildkite'
end
|
Instance Method Details
#build_page(sha, ref) ⇒ Object
83
84
85
|
# File 'app/models/integrations/buildkite.rb', line 83
def build_page(sha, ref)
"#{project_url}/builds?commit=#{sha}"
end
|
#calculate_reactive_cache(sha, ref) ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'app/models/integrations/buildkite.rb', line 103
def calculate_reactive_cache(sha, ref)
response = Gitlab::HTTP.try_get(commit_status_path(sha), request_options)
status =
if response&.code == 200 && response['status']
response['status']
else
:error
end
{ commit_status: status }
end
|
#commit_status(sha, ref) ⇒ Object
75
76
77
|
# File 'app/models/integrations/buildkite.rb', line 75
def commit_status(sha, ref)
with_reactive_cache(sha, ref) { |cached| cached[:commit_status] }
end
|
#commit_status_path(sha) ⇒ Object
79
80
81
|
# File 'app/models/integrations/buildkite.rb', line 79
def commit_status_path(sha)
"#{buildkite_endpoint('gitlab')}/status/#{status_token}.json?commit=#{sha}"
end
|
#enable_ssl_verification ⇒ Object
47
48
49
|
# File 'app/models/integrations/buildkite.rb', line 47
def enable_ssl_verification
true
end
|
#enable_ssl_verification=(_value) ⇒ Object
Since SSL verification will always be enabled for Buildkite, we no longer need to store the boolean. This is a stub method to work with deprecated API param. TODO: remove enable_ssl_verification after 14.0 gitlab.com/gitlab-org/gitlab/-/issues/222808
56
57
58
|
# File 'app/models/integrations/buildkite.rb', line 56
def enable_ssl_verification=(_value)
self.properties = properties.except('enable_ssl_verification') end
|
#execute(data) ⇒ Object
69
70
71
72
73
|
# File 'app/models/integrations/buildkite.rb', line 69
def execute(data)
return unless supported_events.include?(data[:object_kind])
execute_web_hook!(data)
end
|
#hook_url ⇒ Object
61
62
63
|
# File 'app/models/integrations/buildkite.rb', line 61
def hook_url
"#{buildkite_endpoint('webhook')}/deliver/{webhook_token}"
end
|
#url_variables ⇒ Object
65
66
67
|
# File 'app/models/integrations/buildkite.rb', line 65
def url_variables
{ 'webhook_token' => webhook_token }
end
|