diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-11-15 14:21:32 +0000 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-11-16 10:57:27 +0000 |
commit | 9b1a99b03d114e88e2512c75f9711cb38b34bc0c (patch) | |
tree | 009d848349452d7f234d951614bd602e7a83474b | |
parent | a71b3f6a7c13fdc0978a1e9d0151fe15399b8b59 (diff) | |
download | gitlab-ce-9b1a99b03d114e88e2512c75f9711cb38b34bc0c.tar.gz |
Use helm version loop instead of sleep in ClientCommand
-rw-r--r-- | lib/gitlab/kubernetes/helm/client_command.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/kubernetes/helm/install_command_spec.rb | 14 | ||||
-rw-r--r-- | spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/gitlab/kubernetes/helm/client_command.rb b/lib/gitlab/kubernetes/helm/client_command.rb index 0ff0169b61d..bc554684fc7 100644 --- a/lib/gitlab/kubernetes/helm/client_command.rb +++ b/lib/gitlab/kubernetes/helm/client_command.rb @@ -14,7 +14,7 @@ module Gitlab # This is necessary to give Tiller time to restart after upgrade. # Ideally we'd be able to use --wait but cannot because of # https://github.com/helm/helm/issues/4855 - 'sleep 30' + 'for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done' end def repository_command diff --git a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb index 9fa47f9a264..432dab5654d 100644 --- a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb @@ -27,7 +27,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_comand} @@ -56,7 +56,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -87,7 +87,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done #{helm_install_command} EOS end @@ -115,7 +115,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -139,7 +139,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -163,7 +163,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -189,7 +189,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} diff --git a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb index afc926abc27..879f7a444a8 100644 --- a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb @@ -22,7 +22,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end @@ -35,7 +35,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end @@ -59,7 +59,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add #{application.name} #{application.repository} helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS @@ -74,7 +74,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end |