Skip to content

Commit bd69a2a

Browse files
authored
build(java): fix retry_with_backoff when -e option set (#475)
1 parent d9b173c commit bd69a2a

File tree

1 file changed

+12
-2
lines changed
  • synthtool/gcp/templates/java_library/.kokoro

1 file changed

+12
-2
lines changed

synthtool/gcp/templates/java_library/.kokoro/common.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,28 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# set -eo pipefail
17-
1816
function retry_with_backoff {
1917
attempts_left=$1
2018
sleep_seconds=$2
2119
shift 2
2220
command=$@
2321

22+
23+
# store current flag state
24+
flags=$-
25+
26+
# allow a failures to continue
27+
set +e
2428
echo "${command}"
2529
${command}
2630
exit_code=$?
2731

32+
# restore "e" flag
33+
if [[ ${flags} =~ e ]]
34+
then set -e
35+
else set +e
36+
fi
37+
2838
if [[ $exit_code == 0 ]]
2939
then
3040
return 0

0 commit comments

Comments
 (0)