fastlane-plugin-ci_changelog 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6929c151e19d4d869c4420cb5d0416cf9dfa597b5a46cd0ecd98719b1270b564
4
- data.tar.gz: de27968b1da6d06eac4e0df8440982f180bdeb4e3f51fa1ab443e0c21e9e512b
3
+ metadata.gz: f52ebce0dd70e93ac96f3b4657c35605ce07fb7fc2aca8422ad896649f4ff875
4
+ data.tar.gz: a0e353bfee554c35beed63132581feb25570ee8d9b3c1f264b0d0600708c4da8
5
5
  SHA512:
6
- metadata.gz: f427a4c1e91bb112d469e7d78727e840149a527655e9483dfe5861618e654b392339c0c3ef4349aabce7f93c043e9e6b5ef401fcc29ba7a310c187169c821ed9
7
- data.tar.gz: f6f956dc9b13b175869f3cabb88bfa94ffac97cfca3396faf94e627840ff47ea7f836f494dc84a04c1941353037fa5cdc52fbbaa020a79bf02c117664a4bf356
6
+ metadata.gz: d1fa7f713f838b3fb68dae763554fe1c50bcbc14a26d545d88f201abdb0776f08fce8fe7b92e2fe3294d213ee2a844defb03ba8547d7e95047c55ee4540623c8
7
+ data.tar.gz: babd1c34757f6a6a90cb558c177a761d0c59b584d82151103bdf78b8c0c58ff7ecd9abb80b738d7baea2843a95033ba112614725547a92e3a840eed80503cfa8
@@ -76,8 +76,10 @@ module Fastlane
76
76
  build_branch = ENV['GIT_BRANCH']
77
77
  build_number = ENV['BUILD_NUMBER'].to_i
78
78
  loop do
79
+ build_url = "#{ENV['JOB_URL']}#{build_number}/api/json"
80
+ UI.verbose("Fetching changelog #{build_url}")
81
+ UI.verbose("- Branch #{build_branch}")
79
82
  begin
80
- build_url = "#{ENV['JOB_URL']}#{build_number}/api/json"
81
83
  res =
82
84
  if Helper::CiChangelogHelper.determine_jenkins_basic_auth?
83
85
  HTTP.basic_auth(user: @params.fetch(:jenkins_user), pass: @params.fetch(:jenkins_token))
@@ -88,8 +90,6 @@ module Fastlane
88
90
 
89
91
  if res.code == 200
90
92
  build_status, data = Helper::CiChangelogHelper.dump_jenkins_commits(res.body, build_branch)
91
- UI.verbose("Fetching changelog #{build_url}")
92
- UI.verbose("- Branch #{build_branch}")
93
93
  UI.verbose("- Status #{build_status}")
94
94
  UI.verbose("- Changelog #{data}")
95
95
 
@@ -99,10 +99,15 @@ module Fastlane
99
99
  end
100
100
 
101
101
  build_number -= 1
102
-
103
102
  break if build_number <= 0
104
- rescue HTTP::Error
103
+ rescue JSON::ParserError => e
104
+ UI.verbose(e.message)
105
+ build_number -= 1
106
+ break if build_number <= 0
107
+ rescue HTTP::Error => e
105
108
  # NOTE: break out of loop if build setted keep max builds count
109
+ UI.verbose(e.message)
110
+ UI.verbose(e.backtrace.join("\n"))
106
111
  break
107
112
  end
108
113
  end
@@ -131,25 +136,35 @@ module Fastlane
131
136
  build_number = ENV['CI_BUILD_ID'].to_i
132
137
  loop do
133
138
  build_url = "#{@params[:gitlab_url]}/api/v3/projects/#{ENV['CI_PROJECT_ID']}/builds/#{build_number}"
134
- res = HTTP.headers('PRIVATE-TOKEN' => @params[:gitlab_private_token]).get(build_url)
135
-
136
- if res.code == 200
137
- build_status, data = Helper::CiChangelogHelper.dump_gitlab_commits(res.body)
138
- UI.verbose("Fetching changelog #{build_url}")
139
- UI.verbose("- Status #{build_status}")
140
- UI.verbose("- Changelog #{data}")
141
-
142
- if build_status == true
143
- commits = data if commits.empty?
144
- fetch_correct_changelog = true
145
- else
146
- commits = commits.empty? ? data : commits.concat(data)
147
- loop_count += 1
139
+ UI.verbose("Fetching changelog #{build_url}")
140
+
141
+ begin
142
+ res = HTTP.headers('PRIVATE-TOKEN' => @params[:gitlab_private_token]).get(build_url)
143
+ if res.code == 200
144
+ build_status, data = Helper::CiChangelogHelper.dump_gitlab_commits(res.body)
145
+ UI.verbose("- Status #{build_status}")
146
+ UI.verbose("- Changelog #{data}")
147
+
148
+ if build_status == true
149
+ commits = data if commits.empty?
150
+ fetch_correct_changelog = true
151
+ else
152
+ commits = commits.empty? ? data : commits.concat(data)
153
+ loop_count += 1
154
+ end
148
155
  end
149
- end
150
- build_number -= 1
156
+ build_number -= 1
151
157
 
152
- break if fetch_correct_changelog || build_number <= 0
158
+ break if fetch_correct_changelog || build_number <= 0
159
+ rescue JSON::ParserError => e
160
+ UI.verbose(e.message)
161
+ build_number -= 1
162
+ break if fetch_correct_changelog || build_number <= 0
163
+ rescue HTTP::Error => e
164
+ UI.verbose(e.message)
165
+ UI.verbose(e.backtrace.join("\n"))
166
+ break
167
+ end
153
168
  end
154
169
 
155
170
  Helper::CiChangelogHelper.store_sharedvalue(SharedValues::CICL_CHANGELOG, commits.to_json)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module CiChangelog
3
- VERSION = '0.5.5'.freeze
3
+ VERSION = '0.5.6'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-ci_changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-27 00:00:00.000000000 Z
11
+ date: 2019-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http