summaryrefslogtreecommitdiff
path: root/lib/gitlab/kubernetes/pod_cmd.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/kubernetes/pod_cmd.rb')
-rw-r--r--lib/gitlab/kubernetes/pod_cmd.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/kubernetes/pod_cmd.rb b/lib/gitlab/kubernetes/pod_cmd.rb
new file mode 100644
index 00000000000..e4c25424e69
--- /dev/null
+++ b/lib/gitlab/kubernetes/pod_cmd.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Kubernetes
+ # Miscellaneous commands that run in the helm-install-image pod, tuned to
+ # the idiosynchrasies of the default shell of helm-install-image
+ module PodCmd
+ class << self
+ def retry_command(command, times: 3)
+ "for i in $(seq 1 #{times.to_i}); do #{command} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s)"
+ end
+ end
+ end
+ end
+end