Class: Integrations::Buildkite
Constant Summary
collapse
- ENDPOINT =
"https://buildkite.com"
Constants inherited
from Integration
Integration::BASE_CLASSES, Integration::DEV_INTEGRATION_NAMES, Integration::INTEGRATION_NAMES, Integration::PROJECT_SPECIFIC_INTEGRATION_NAMES, Integration::SECTION_TYPE_CONNECTION, Integration::UnknownType
ApplicationRecord::MAX_PLUCK
Instance Attribute Summary
Attributes included from Importable
#imported, #importing
Class Method Summary
collapse
Instance Method Summary
collapse
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods included from HasWebHook
#execute_web_hook!, #hook_ssl_verification, #update_web_hook!
Methods inherited from BaseCi
#valid_token?
Methods inherited from Integration
#activate_disabled_reason, #activated?, #api_field_names, #async_execute, #attributes, available_integration_names, available_integration_types, boolean_accessor, build_from_integration, #category, #configurable_events, create_from_active_default_integrations, default_integration, default_test_event, #default_test_event, dev_integration_names, #dup, #editable?, #event_channel_names, event_description, #event_field, #event_names, event_names, field, fields, #fields, find_or_initialize_all_non_project_specific, find_or_initialize_non_project_specific_integration, #global_fields, #group_level?, #inheritable?, inherited_descendants_from_self_or_ancestors_from, #initialize_properties, instance_exists_for?, #instance_level?, integration_name_to_model, integration_name_to_type, integration_names, #json_fields, #operating?, #parent, #project_level?, project_specific_integration_names, prop_accessor, #properties=, #reencrypt_properties, #reset_updated_properties, #secret_fields, #sections, #show_active_box?, #supported_events, #supports_data_fields?, #test, #testable?, #to_data_fields_hash, #to_integration_hash, #to_param, #updated_properties
#exposing_secrets_fields
Methods included from Loggable
#build_message, #log_error, #log_exception, #log_info, #logger
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, 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
#serializable_hash
Class Method Details
.supported_events ⇒ Object
29
30
31
|
# File 'app/models/integrations/buildkite.rb', line 29
def self.supported_events
%w(push merge_request tag_push)
end
|
.to_param ⇒ Object
80
81
82
|
# File 'app/models/integrations/buildkite.rb', line 80
def self.to_param
'buildkite'
end
|
Instance Method Details
#build_page(sha, ref) ⇒ Object
68
69
70
|
# File 'app/models/integrations/buildkite.rb', line 68
def build_page(sha, ref)
"#{project_url}/builds?commit=#{sha}"
end
|
#calculate_reactive_cache(sha, ref) ⇒ Object
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'app/models/integrations/buildkite.rb', line 88
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
60
61
62
|
# File 'app/models/integrations/buildkite.rb', line 60
def commit_status(sha, ref)
with_reactive_cache(sha, ref) {|cached| cached[:commit_status] }
end
|
#commit_status_path(sha) ⇒ Object
64
65
66
|
# File 'app/models/integrations/buildkite.rb', line 64
def commit_status_path(sha)
"#{buildkite_endpoint('gitlab')}/status/#{status_token}.json?commit=#{sha}"
end
|
#description ⇒ Object
76
77
78
|
# File 'app/models/integrations/buildkite.rb', line 76
def description
'Run CI/CD pipelines with Buildkite.'
end
|
#enable_ssl_verification ⇒ Object
36
37
38
|
# File 'app/models/integrations/buildkite.rb', line 36
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
45
46
47
|
# File 'app/models/integrations/buildkite.rb', line 45
def enable_ssl_verification=(_value)
self.properties = properties.except('enable_ssl_verification') end
|
#execute(data) ⇒ Object
54
55
56
57
58
|
# File 'app/models/integrations/buildkite.rb', line 54
def execute(data)
return unless supported_events.include?(data[:object_kind])
execute_web_hook!(data)
end
|
#help ⇒ Object
84
85
86
|
# File 'app/models/integrations/buildkite.rb', line 84
def help
s_('ProjectService|Run CI/CD pipelines with Buildkite.')
end
|
#hook_url ⇒ Object
50
51
52
|
# File 'app/models/integrations/buildkite.rb', line 50
def hook_url
"#{buildkite_endpoint('webhook')}/deliver/#{webhook_token}"
end
|
#title ⇒ Object
72
73
74
|
# File 'app/models/integrations/buildkite.rb', line 72
def title
'Buildkite'
end
|