Skip to content

Commit

Permalink
helm-install: Make helm install failure fatal
Browse files Browse the repository at this point in the history
Currently, when helm install fails, testsuite still waits for resources
and only fails on timeout.
Fix helm behavior and make it exit right after installation failure.

Signed-off-by: Konstantin Yarovoy <[email protected]>
  • Loading branch information
Konstantin Yarovoy committed Aug 19, 2024
1 parent 11aeb49 commit 89f12fe
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/tasks/utils/cnf_manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ module CNFManager
fresh_install = true

helm_install = {status: "", output: "", error: ""}
helm_error = false

# todo determine what the ric is/if there is a ric installed (labeling)
#option 1
Expand Down Expand Up @@ -715,11 +714,10 @@ module CNFManager
Log.for("verbose").info { "deploying with chart repository" } if verbose
begin
helm_install = Helm.install(release_name, helm_chart, helm_namespace_option, helm_values)
# helm_install = Helm.install("#{release_name} #{helm_chart} #{helm_namespace_option}")
rescue e : Helm::InstallationFailed
stdout_failure "Helm installation failed"
stdout_failure "\t#{e.message}"
helm_error = true
exit 1
rescue e : Helm::CannotReuseReleaseNameError
stdout_warning "Release name #{release_name} has already been setup."
# Mark that install is not fresh
Expand All @@ -731,12 +729,11 @@ module CNFManager
#TODO Add helm options into cnf-testsuite yml
#e.g. helm install nsm --set insecure=true ./nsm/helm_chart
begin
# helm_install = Helm.install("#{release_name} #{destination_cnf_dir}/#{helm_directory} #{helm_namespace_option}")
helm_install = Helm.install(release_name, "#{install_method[1]}", helm_namespace_option, helm_values)
rescue e : Helm::InstallationFailed
stdout_failure "Helm installation failed"
stdout_failure "\t#{e.message}"
helm_error = true
exit 1
rescue e : Helm::CannotReuseReleaseNameError
stdout_warning "Release name #{release_name} has already been setup."
# Mark that install is not fresh
Expand Down Expand Up @@ -848,12 +845,10 @@ module CNFManager
Log.info { "final liveness_time: #{liveness_time}" }
Log.info { "elapsed_time.seconds: #{elapsed_time.seconds}" }
Log.info { "helm_install: #{helm_install}" }
Log.info { "helm_error: #{helm_error}" }
Log.info { "helm_install[:error].to_s: #{helm_install[:error].to_s}" }
Log.info { "helm_install[:error].to_s.size: #{helm_install[:error].to_s.size}" }
helm_used = false
if helm_install && !helm_error # fails on warnings ... && helm_install[:error].to_s.size == 0 # && helm_pull.to_s.size > 0
helm_used = true

if fresh_install
stdout_success "Successfully setup #{release_name}"
end

Expand All @@ -866,6 +861,7 @@ module CNFManager
immutable_configmap = false
end

helm_used = !helm_install[:status].is_a?(String)
#TODO if helm_install then set helm_deploy = true in template
Log.info { "save config" }
elapsed_time_template = ElapsedTimeConfigMapTemplate.new(
Expand Down

0 comments on commit 89f12fe

Please sign in to comment.