fast_ci 1.0.11 → 1.1.0

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: fb41363c3f2f501d704a926f3f303a598511321587a29c11637da3c4c7575aae
4
- data.tar.gz: c8f82f7ecdba6962cf364807ba92bfe7f0cc2725a903e9669e55477853db78a1
3
+ metadata.gz: c198e20b22117ce90305fa7c2f82c512ef268097b46c63fcb9cdfaaa9c45aa1d
4
+ data.tar.gz: cede75f91ab2fad8ee74715660a273ed9a0f229f40beb0875b4edc6ae253d550
5
5
  SHA512:
6
- metadata.gz: 8d248e5e58f8437d7fac17568606bd0dde08ea502d0b6aab33affb57ea8e24575fc9a8e6e5324a02463c0f1886d10d05aa23918b5e890525add1da4364097fbd
7
- data.tar.gz: 9d6913a04a6abf413b702baa7134fad68e65597d7a74857514c9e8ffc58a135373ff2b19730d93ba2dd36a407096b7c419f52c6a5d842acaff65dfdfe2c3529b
6
+ metadata.gz: 04040e4fff496fe2065fc2f120160fc29f253322abe3f6f526f9516e88bd9feb98ddb1319ce161858f204eacc2c59d6dccd2390645b1f168e254a91ad1ccb89e
7
+ data.tar.gz: 168c07fddb1154357fa647d5d59e61a8a248206f933a96f437ff4ac8d2a485b56c8b15b0cecc05a9974ad181d8cff8cc999129767ae92de4993c6ea20fdbd40c
data/Gemfile.lock CHANGED
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- fast_ci (1.0.11)
14
+ fast_ci (1.1.0)
15
15
  async-websocket (<= 0.20.0)
16
16
  brakeman (>= 5.4.1)
17
17
  console (>= 1.10.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastCI
4
- VERSION = "1.0.11"
4
+ VERSION = "1.1.0"
5
5
  end
data/lib/fast_ci.rb CHANGED
@@ -54,8 +54,16 @@ module FastCI
54
54
  minitest_ws.await
55
55
  end
56
56
 
57
+ def error(msg)
58
+ STDERR.puts "\e[31m[FastCI] #{msg}\e[0m"
59
+ end
60
+
57
61
  def debug(msg)
58
- puts "\n\e[36mDEBUG: \e[0m #{msg}\n" if ENV["FAST_CI_DEBUG"]
62
+ puts "\e[36mDEBUG: \e[0m #{msg}\n" if ENV["FAST_CI_DEBUG"]
63
+ end
64
+
65
+ def log(msg)
66
+ puts "\e[0m[FastCI] #{msg}\e[0m"
59
67
  end
60
68
 
61
69
  def report_options(run_key, content)
@@ -138,13 +146,13 @@ module FastCI
138
146
  rescue Async::WebSocket::ProtocolError => e
139
147
  case e.message
140
148
  when "Failed to negotiate connection: 401"
141
- STDERR.puts "Failed to connect: Invalid secret key!"
149
+ FastCI.error("Failed to connect: Invalid secret key!")
142
150
  exit 2
143
151
  when "Failed to negotiate connection: 403"
144
- STDERR.puts "Failed to connect: Invalid or disabled run key!"
152
+ FastCI.error("Failed to connect: Invalid or disabled run key!")
145
153
  exit 2
146
- when "Failed to negotiate connection: 500"
147
- STDERR.puts "Failed to connect: General connection error!"
154
+ else
155
+ FastCI.error("Failed to connect: General connection error!")
148
156
  exit 2
149
157
  end
150
158
  end
@@ -163,7 +171,7 @@ module FastCI
163
171
 
164
172
  case response&.dig(:event) || message[:event]
165
173
  when "phx_error"
166
- raise("[FastCI] Unexpected error")
174
+ raise("Unexpected server error")
167
175
  when "join"
168
176
  handle_join(response)
169
177
  when "failed_join"
@@ -179,15 +187,12 @@ module FastCI
179
187
  else
180
188
  break
181
189
  end
182
- when "error"
183
- raise(response.inspect)
184
190
  else
185
- puts response
191
+ raise(response.inspect)
186
192
  end
187
193
  end
188
194
  rescue => e
189
- puts e.message
190
- puts e.backtrace.join("\n")
195
+ FastCI.error("Unexpected error: #{e.message}\n\t#{e.backtrace.join("\n\t")}")
191
196
  task&.stop
192
197
  end
193
198
  end
@@ -227,8 +232,13 @@ module FastCI
227
232
  end
228
233
 
229
234
  def handle_join_fail(response)
230
- STDERR.puts "Can't join because of test state being: #{response[:state]}"
231
- exit 3
235
+ if response[:state] == "passed"
236
+ FastCI.log("Can't join because of run's state being: #{response[:state]}")
237
+ exit 0
238
+ else
239
+ FastCI.error("Can't join because of run's state being: #{response[:state]}")
240
+ exit 1
241
+ end
232
242
  end
233
243
 
234
244
  def handle_deq_request(_response)
@@ -240,7 +250,7 @@ module FastCI
240
250
  end
241
251
 
242
252
  def topic
243
- "test_orchestrator:#{run_key}-#{FastCI.configuration.build_id}"
253
+ "test_orchestrator:#{run_key}-#{FastCI.configuration.commit}-#{FastCI.configuration.build_id}"
244
254
  end
245
255
 
246
256
  def endpoint
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nesha Zoric
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-07 00:00:00.000000000 Z
11
+ date: 2024-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: console