Skip to content

Commit 682689c

Browse files
committed
Fix runner readiness logic check
1 parent 9b4c8ea commit 682689c

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Changes since the last non-beta release.
1414

1515
_Please add entries here for your pull requests that have not yet been released._
1616

17+
### Fixed
18+
19+
- Fixed issue where `run` command could hang indefinitely when updating runner workload. [PR 260](https://github.com/shakacode/control-plane-flow/pull/260) by [Sergey Tarasov](https://github.com/dzirtusss).
20+
1721
## [4.1.1] - 2025-03-14
1822

1923

lib/command/run.rb

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class Run < Base # rubocop:disable Metrics/ClassLength
9797

9898
attr_reader :interactive, :detached, :location, :original_workload, :runner_workload,
9999
:default_image, :default_cpu, :default_memory, :job_timeout, :job_history_limit,
100-
:container, :expected_deployed_version, :job, :replica, :command
100+
:container, :job, :replica, :command
101101

102102
def call # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
103103
@interactive = config.options[:interactive] || interactive_command?
@@ -126,10 +126,7 @@ def call # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, M
126126
end
127127

128128
create_runner_workload if cp.fetch_workload(runner_workload).nil?
129-
wait_for_runner_workload_deploy
130129
update_runner_workload
131-
wait_for_runner_workload_update if expected_deployed_version
132-
133130
start_job
134131
wait_for_replica_for_job
135132

@@ -242,24 +239,10 @@ def update_runner_workload # rubocop:disable Metrics/CyclomaticComplexity, Metri
242239
return unless should_update
243240

244241
step("Updating runner workload '#{runner_workload}'") do
245-
# Update runner workload
246-
@expected_deployed_version = (cp.cron_workload_deployed_version(runner_workload) || 0) + 1
247242
cp.apply_hash("kind" => "workload", "name" => runner_workload, "spec" => spec)
248243
end
249244
end
250245

251-
def wait_for_runner_workload_deploy
252-
step("Waiting for runner workload '#{runner_workload}' to be deployed", retry_on_failure: true) do
253-
!cp.cron_workload_deployed_version(runner_workload).nil?
254-
end
255-
end
256-
257-
def wait_for_runner_workload_update
258-
step("Waiting for runner workload '#{runner_workload}' to be updated", retry_on_failure: true) do
259-
(cp.cron_workload_deployed_version(runner_workload) || 0) >= expected_deployed_version
260-
end
261-
end
262-
263246
def start_job
264247
job_start_yaml = build_job_start_yaml
265248

lib/core/controlplane.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ def apply_template(data) # rubocop:disable Metrics/MethodLength
409409
f.write(data)
410410
f.rewind
411411
cmd = "cpln apply #{gvc_org} --file #{f.path}"
412+
cmd += " --ready" unless ENV.fetch("DISABLE_APPLY_READY", nil)
412413
if Shell.tmp_stderr
413414
cmd += " 2> #{Shell.tmp_stderr.path}" if Shell.should_hide_output?
414415

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
ENV["HIDE_COMMAND_OUTPUT"] = "true"
55
ENV["DISABLE_INTERRUPT_TRAP"] = "true"
66
ENV["DISABLE_VALIDATIONS"] = "true"
7+
ENV["DISABLE_APPLY_READY"] = "true"
78

89
require "rspec/retry"
910
require "simplecov"

0 commit comments

Comments
 (0)