Read about our upcoming Code of Conduct on this issue

ci_service.rb 968 Bytes
Newer Older
1
2
# frozen_string_literal: true

3
4
5
6
# Base class for CI services
# List methods you need to implement to get your CI service
# working with GitLab Merge Requests
class CiService < Service
7
8
  default_value_for :category, 'ci'

Kirilll Zaitsev's avatar
Kirilll Zaitsev committed
9
  def valid_token?(token)
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
10
    self.respond_to?(:token) && self.token.present? && ActiveSupport::SecurityUtils.secure_compare(token, self.token)
Kirilll Zaitsev's avatar
Kirilll Zaitsev committed
11
  end
12

13
  def self.supported_events
14
15
16
    %w(push)
  end

17
  # Return complete url to build page
18
19
20
21
  #
  # Ex.
  #   http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c
  #
Valery Sizov's avatar
Valery Sizov committed
22
  def build_page(sha, ref)
23
24
25
    # implement inside child
  end

Kirilll Zaitsev's avatar
Kirilll Zaitsev committed
26
27
28
29
30
31
32
  # Return string with build status or :error symbol
  #
  # Allowed states: 'success', 'failed', 'running', 'pending', 'skipped'
  #
  #
  # Ex.
  #   @service.commit_status('13be4ac', 'master')
33
34
  #   # => 'success'
  #
Kirilll Zaitsev's avatar
Kirilll Zaitsev committed
35
  #   @service.commit_status('2abe4ac', 'dev')
36
37
38
  #   # => 'running'
  #
  #
Valery Sizov's avatar
Valery Sizov committed
39
  def commit_status(sha, ref)
40
41
42
    # implement inside child
  end
end