Skip to content

Commit

Permalink
build(java): fix retry_with_backoff when -e option set (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
chingor13 authored Apr 8, 2020
1 parent d9b173c commit bd69a2a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions synthtool/gcp/templates/java_library/.kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# set -eo pipefail

function retry_with_backoff {
attempts_left=$1
sleep_seconds=$2
shift 2
command=$@


# store current flag state
flags=$-

# allow a failures to continue
set +e
echo "${command}"
${command}
exit_code=$?

# restore "e" flag
if [[ ${flags} =~ e ]]
then set -e
else set +e
fi

if [[ $exit_code == 0 ]]
then
return 0
Expand Down

0 comments on commit bd69a2a

Please sign in to comment.