mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-27 08:40:23 +00:00
ci: improve logging for kubectl_retry
helper
Rook deployments fail quite regulary in the CI environment now. It is
not clear what the cause is, hopefully a little better logging will
guide us to the issue.
Now executing `kubectl` in a sub-shell, ensuring that the redirection of
the command lands in the right files.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
(cherry picked from commit 1e21972956
)
This commit is contained in:
parent
b50d8596ea
commit
2f7fb80498
@ -11,7 +11,7 @@ kubectl_retry() {
|
|||||||
stdout=$(mktemp rook-kubectl-stdout.XXXXXXXX)
|
stdout=$(mktemp rook-kubectl-stdout.XXXXXXXX)
|
||||||
stderr=$(mktemp rook-kubectl-stderr.XXXXXXXX)
|
stderr=$(mktemp rook-kubectl-stderr.XXXXXXXX)
|
||||||
|
|
||||||
while ! kubectl "${action}" "${@}" 2>"${stderr}" 1>"${stdout}"
|
while ! ( kubectl "${action}" "${@}" 2>"${stderr}" 1>"${stdout}" )
|
||||||
do
|
do
|
||||||
# in case of a failure when running "create", ignore errors with "AlreadyExists"
|
# in case of a failure when running "create", ignore errors with "AlreadyExists"
|
||||||
if [ "${action}" == 'create' ]
|
if [ "${action}" == 'create' ]
|
||||||
@ -47,7 +47,7 @@ kubectl_retry() {
|
|||||||
# log stderr and empty the tmpfile
|
# log stderr and empty the tmpfile
|
||||||
cat "${stderr}" > /dev/stderr
|
cat "${stderr}" > /dev/stderr
|
||||||
true > "${stderr}"
|
true > "${stderr}"
|
||||||
echo "kubectl_retry ${*} failed, will retry in ${KUBECTL_RETRY_DELAY} seconds"
|
echo "$(date): 'kubectl_retry ${*}' failed (${retries}/${KUBECTL_RETRY}), will retry in ${KUBECTL_RETRY_DELAY} seconds" > /dev/stderr
|
||||||
|
|
||||||
sleep ${KUBECTL_RETRY_DELAY}
|
sleep ${KUBECTL_RETRY_DELAY}
|
||||||
|
|
||||||
@ -56,6 +56,8 @@ kubectl_retry() {
|
|||||||
ret=0
|
ret=0
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "$(date): 'kubectl_retry ${*}' done (ret=${ret})" > /dev/stderr
|
||||||
|
|
||||||
# write output so that calling functions can consume it
|
# write output so that calling functions can consume it
|
||||||
cat "${stdout}" > /dev/stdout
|
cat "${stdout}" > /dev/stdout
|
||||||
cat "${stderr}" > /dev/stderr
|
cat "${stderr}" > /dev/stderr
|
||||||
|
Loading…
Reference in New Issue
Block a user