-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retry some commands when failed #377
Conversation
59f3372
to
9eae6d0
Compare
9eae6d0
to
6051ce2
Compare
Surprisingly, it worked. Could catch an example of this "super-intelligent auto-remediation" 😃 : Here is the build where
|
Nice work 👍 Sadly there are still too many intermediate failures not directly related to our stuff and which we can't control so this should hopefully help a lot :) |
@@ -30,6 +30,10 @@ else | |||
DEB_DISTRO := $(shell lsb_release -cs) | |||
endif | |||
|
|||
# Makefile function to retry the failed command 'N' times | |||
# Example: $(call retry,3,some_script.sh) | |||
retry = $(2) $(foreach t,$(shell seq 1 ${1}),|| (echo -e "\033[33m Failed ($$?): '$(2)'\n Retrying $t ... \033[0m"; $(2))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bash one liner!
I would prefer to make it just a normal function since it's more readable, but whatever :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't like it too. But that's how it's usually done with make custom functions: https://www.gnu.org/software/make/manual/make.html#Call-Function
Multi-line/bash function would be even worse and easier to mess (ex: http://stackoverflow.com/questions/12774787/how-to-define-global-shell-functions-in-a-makefile).
I'll play with retries builds https://circleci.com/gh/StackStorm/st2-packages/tree/feature%2Fretry-on-failure more and if I'll find that 1
single command retry was enough in all cases,
maybe just:
pip wheel --wheel-dir=$(WHEELDIR) --find-links=$(WHEELDIR) -r requirements.txt || \
pip wheel --wheel-dir=$(WHEELDIR) --find-links=$(WHEELDIR) -r requirements.txt
and I started with that first, but decided to go with something more re-usable.
So maybe retry function with echo-s and makefile alien syntax is overcomplication here.
Also, I don't know how easy it is to do, but it would be nice to have some kind of "test" for the retry function. This way we can be positive that retry function which is not working correctly won't mask the failures and cause builds to succeed. I know the build would still probably fail somewhere else down the chain, but I would feel more comfortable with such "test" / check :) |
MAKE BUILDS GREAT AGAIN. |
Considering our discussions @Kami @lakshmi-kannan, 👎 x Let's see how this change behaves to get less failures and see what else we can adjust. |
LGTM 👍 Let's try it and see how it goes :) |
Brings function to retry failing command in Makefile.
And while
pip
has its own connection-retrying mechanism (with--retries <retries>
default5
), most probably something wrong with it or it's not enough (?).Anyways, experimenting. It's strange how frequently we have upstream connection errors like:
More technical debt that is good to address in future: