ci_toolkit 1.5.2 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f898f9b883854f34b85fd9b3fb178cb1847ed5b475efbc0b4187c177462ac472
4
- data.tar.gz: f458d206ac2232774d18894d92e97ecdd74e18b1c302ad65242cadaaca3deff0
3
+ metadata.gz: 6d09aaba9d8cf3b06b0cf990f59346ebd0b60b461569a062f57eaee7343474b2
4
+ data.tar.gz: 0f12abd8ebbb6abf38705c948d4c2f651413c918828b3008118a18cb1b7082de
5
5
  SHA512:
6
- metadata.gz: 4a0e324896a793433044ab293b65d842f96492e7d793c9c9a39eb61ef98557d857e8081faf7db3067ffa7b44f369a3dbc71dea750420b6b935c976d003d18a81
7
- data.tar.gz: 3254a489095f1a9b2e5667986df0aef5e81cfba1d5e0e53ff68dfbfa795d67c98bbcc44af03e94196ed5b603d7426bdec1f29458b39947aa92b70bf60d3a72f3
6
+ metadata.gz: 404cd49f9ecd10a0959d540e13ff9bd2f40e2804af2949e1fc1f3b987eb68d51a841bb722baef9bfd60c05c3cdf4a7a6e988115d219fa276fab8a7409e253f66
7
+ data.tar.gz: 522b89584b12430ae41f5a977ea3c1d0dae10c81d4be7e0fe561d3878cb03b2fa031a0007626f7df89e6efccefec755215344cbfb23f56e57e4d174a52c49f62
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.5.2)
4
+ ci_toolkit (1.5.5)
5
5
  faraday
6
6
  faraday_middleware
7
7
  gitlab
@@ -40,17 +40,16 @@ module CiToolkit
40
40
  @github.create_status(state, @context, @env.app_url, "Finished building #{num_finished}/#{num_total}")
41
41
  end
42
42
 
43
- def error
44
- @github.create_status("error", @context, @env.app_url, "Building failed")
43
+ def error(state = CiToolkit::DvcsPrUtil.status_state)
44
+ @github.create_status(state, @context, @env.app_url, "Building failed")
45
45
  end
46
46
 
47
47
  private
48
48
 
49
49
  def load_counter
50
- status = @github.get_status(@context)
51
- return if status.nil?
50
+ description = @github.get_status_description(@context)
51
+ return if description.nil?
52
52
 
53
- description = status[:description]
54
53
  build_counter = description[%r{(\d/\d)}] || "0/0"
55
54
  { num_finished: build_counter.split("/")[0].to_i, num_total: build_counter.split("/")[1].to_i }
56
55
  end
@@ -97,5 +97,20 @@ module CiToolkit
97
97
  def realm_module_modified?
98
98
  CiToolkit::DvcsPr.api_not_implemented(self)
99
99
  end
100
+
101
+ def get_status_description(_context)
102
+ CiToolkit::DvcsPr.api_not_implemented(self)
103
+ end
104
+ end
105
+
106
+ # Use this to provide commit status state for github or gitlab as
107
+ # values for the two services are different
108
+ # It uses the ENV["DVCS_SERVICE"] to decide which DVCS to use.
109
+ class DvcsPrUtil
110
+ def self.status_state(service = ENV["DVCS_SERVICE"])
111
+ status = "error"
112
+ status = "failed" if service == "gitlab"
113
+ status
114
+ end
100
115
  end
101
116
  end
@@ -110,6 +110,13 @@ module CiToolkit
110
110
  modified_files.length.positive?
111
111
  end
112
112
 
113
+ def get_status_description(context)
114
+ status = get_status(context)
115
+ return if status.nil?
116
+
117
+ status[:description]
118
+ end
119
+
113
120
  private
114
121
 
115
122
  def client
@@ -66,7 +66,7 @@ module CiToolkit
66
66
  end
67
67
 
68
68
  def files
69
- client.merge_request_changes(@repo_slug, @pr_number)
69
+ client.merge_request_changes(@repo_slug, @pr_number).changes
70
70
  end
71
71
 
72
72
  def create_status(state, context, target_url, description)
@@ -74,7 +74,7 @@ module CiToolkit
74
74
  @repo_slug,
75
75
  @commit_sha,
76
76
  state,
77
- { context: context, target_url: target_url, description: description }
77
+ { name: context, target_url: target_url, description: description }
78
78
  )
79
79
  end
80
80
 
@@ -113,12 +113,17 @@ module CiToolkit
113
113
  modified_files.length.positive?
114
114
  end
115
115
 
116
+ def get_status_description(context)
117
+ status = get_status(context)
118
+ return if status.nil?
119
+
120
+ status.description
121
+ end
122
+
116
123
  private
117
124
 
118
125
  def client
119
126
  @_client = GitLab::Client.new if @_client.nil?
120
- # @_client.access_token = @bot.create_token if @_client.access_token.nil?
121
-
122
127
  @_client
123
128
  end
124
129
  end
@@ -6,7 +6,7 @@ module CiToolkit
6
6
  attr_reader :ticket
7
7
 
8
8
  def initialize(
9
- github_pr = CiToolkit::GithubPr.new,
9
+ github_pr = CiToolkit::DvcsPrFactory.create(CiToolkit::BitriseEnv.new),
10
10
  git = CiToolkit::Git.new,
11
11
  ticket_regex_keys = ENV["SUPPORTED_JIRA_PROJECT_KEYS_REGEX"]
12
12
  )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller