selective-ruby-core 0.1.3-arm64-darwin → 0.1.5-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bin/build_env.sh +5 -5
- data/lib/selective/ruby/core/controller.rb +35 -4
- data/lib/selective/ruby/core/version.rb +1 -1
- data/lib/selective-ruby-core.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39560fda863eb6d5cd3d9e73f38e6676b13dc7cc01fb22f80d66e2f17c100ee1
|
4
|
+
data.tar.gz: 4fc1593748ca902179f489c00c0f6fbcfe6f40f33f55cccd97dd18bf969b9290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 799612fd1bf0768e3bfbb82411bd933cfe87246ecba07695ebecf6d581beaf2c7c27a63264dfc5864421129c44f4dd8d7ff8d99ed4412722c31811c4ee382d20
|
7
|
+
data.tar.gz: 87147a1eab4603f7be55c571c76d90881348a033bb79082abb21e7c883b5c6e936842848114bb4a08cd4c768d665a4665303b86eb9a0774826675208ee73ffa0
|
data/lib/bin/build_env.sh
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
if [ -n "$GITHUB_ACTIONS" ]; then
|
5
5
|
# Get environment variables
|
6
6
|
platform=github_actions
|
7
|
-
branch=${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}
|
7
|
+
branch=${SELECTIVE_BRANCH:-${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}}
|
8
8
|
pr_title=$SELECTIVE_PR_TITLE
|
9
|
-
target_branch=${GITHUB_BASE_REF}
|
9
|
+
target_branch=${SELECTIVE_TARGET_BRANCH:-$GITHUB_BASE_REF}
|
10
10
|
actor=$GITHUB_ACTOR
|
11
|
-
sha=$GITHUB_SHA
|
12
|
-
run_id=$GITHUB_RUN_ID
|
13
|
-
run_attempt=$GITHUB_RUN_ATTEMPT
|
11
|
+
sha=${SELECTIVE_SHA:-$GITHUB_SHA}
|
12
|
+
run_id=${SELECTIVE_RUN_ID:-$GITHUB_RUN_ID}
|
13
|
+
run_attempt=${SELECTIVE_RUN_ATTEMPT:-$GITHUB_RUN_ATTEMPT}
|
14
14
|
commit_message=$(git log --format=%s -n 1 $sha)
|
15
15
|
else
|
16
16
|
platform=$SELECTIVE_PLATFORM
|
@@ -14,7 +14,7 @@ module Selective
|
|
14
14
|
@debug = debug
|
15
15
|
@runner = runner
|
16
16
|
@retries = 0
|
17
|
-
@runner_id = ENV.fetch("SELECTIVE_RUNNER_ID", generate_runner_id)
|
17
|
+
@runner_id = safe_filename(ENV.fetch("SELECTIVE_RUNNER_ID", generate_runner_id))
|
18
18
|
@logger = init_logger(log)
|
19
19
|
end
|
20
20
|
|
@@ -23,6 +23,7 @@ module Selective
|
|
23
23
|
@transport_pid = spawn_transport_process(reconnect ? transport_url + "&reconnect=true" : transport_url)
|
24
24
|
|
25
25
|
handle_termination_signals(transport_pid)
|
26
|
+
wait_for_connectivity
|
26
27
|
run_main_loop
|
27
28
|
rescue NamedPipe::PipeClosedError
|
28
29
|
retry!
|
@@ -66,8 +67,6 @@ module Selective
|
|
66
67
|
def run_main_loop
|
67
68
|
loop do
|
68
69
|
message = pipe.read
|
69
|
-
next sleep(0.1) if message.nil? || message.empty?
|
70
|
-
|
71
70
|
response = JSON.parse(message, symbolize_names: true)
|
72
71
|
|
73
72
|
@logger.info("Received Command: #{response}")
|
@@ -153,6 +152,31 @@ module Selective
|
|
153
152
|
end
|
154
153
|
end
|
155
154
|
|
155
|
+
def wait_for_connectivity
|
156
|
+
@connectivity = false
|
157
|
+
|
158
|
+
Thread.new do
|
159
|
+
sleep(30)
|
160
|
+
unless @connectivity
|
161
|
+
puts "Transport process failed to start. Exiting..."
|
162
|
+
kill_transport
|
163
|
+
exit(1)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
loop do
|
168
|
+
message = pipe.read
|
169
|
+
|
170
|
+
# The message is nil until the transport opens the pipe
|
171
|
+
# for writing. So, we must handle that here.
|
172
|
+
next sleep(0.1) if message.nil?
|
173
|
+
|
174
|
+
response = JSON.parse(message, symbolize_names: true)
|
175
|
+
@connectivity = true if response[:command] == "connected"
|
176
|
+
break
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
156
180
|
def handle_termination_signals(pid)
|
157
181
|
["INT", "TERM"].each do |signal|
|
158
182
|
Signal.trap(signal) do
|
@@ -175,7 +199,7 @@ module Selective
|
|
175
199
|
|
176
200
|
sleep(1)
|
177
201
|
end
|
178
|
-
rescue NamedPipe::PipeClosedError
|
202
|
+
rescue NamedPipe::PipeClosedError, IOError
|
179
203
|
# If the pipe is close, move straight to killing
|
180
204
|
# it forcefully.
|
181
205
|
end
|
@@ -272,6 +296,13 @@ module Selective
|
|
272
296
|
@debug
|
273
297
|
end
|
274
298
|
|
299
|
+
def safe_filename(filename)
|
300
|
+
filename
|
301
|
+
.gsub(/[\/\\:*?"<>|\n\r]+/, '_')
|
302
|
+
.gsub(/^\.+|\.+$/, '')
|
303
|
+
.strip[0, 255]
|
304
|
+
end
|
305
|
+
|
275
306
|
def with_error_handling(include_header: true)
|
276
307
|
yield
|
277
308
|
rescue => e
|
data/lib/selective-ruby-core.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selective-ruby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Benjamin Wood
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: zeitwerk
|