ruby-changes:56856
From: Takashi <ko1@a...>
Date: Wed, 7 Aug 2019 21:49:33 +0900 (JST)
Subject: [ruby-changes:56856] Takashi Kokubun: 330e3f19c3 (master): Refactor .travis.yml by introducing travis_retry.sh
https://git.ruby-lang.org/ruby.git/commit/?id=330e3f19c3 From 330e3f19c32dc6b0c287b7845c796e7e4a3ed575 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Wed, 7 Aug 2019 21:47:03 +0900 Subject: Refactor .travis.yml by introducing travis_retry.sh Not using official travis_retry.bash, because it's not supporting to modify backoff seconds. https://github.com/travis-ci/travis-build/blob/0ad8f1886b2c31994d847e126dc5842b7b3513e3/lib/travis/build/bash/travis_retry.bash Not using official `travis_apt_get_update` function because it does not propagate exit status to be used by retries. https://github.com/travis-ci/travis-build/blob/0ad8f1886b2c31994d847e126dc5842b7b3513e3/lib/travis/build/bash/travis_apt_get_update.bash Co-Authored-By: Nobuyoshi Nakada <nobu@r...> diff --git a/.travis.yml b/.travis.yml index 44545a7..56c683d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,67 +88,51 @@ env: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L88 # sources: # - ubuntu-toolchain-r-test before_install: + - tool/travis_retry.sh sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" + - tool/travis_retry.sh bash -c "sudo rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && sudo apt-get update -yq" - |- - for seconds in 1 25 100 -1; do - sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break - sleep "$seconds" || exit 1 - done - - |- - for seconds in 1 25 100 -1; do - travis_apt_get_update - - sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \ - gcc-8 \ - libffi-dev \ - libgdbm-dev \ - libgmp-dev \ - libjemalloc-dev \ - libncurses5-dev \ - libncursesw5-dev \ - libreadline6-dev \ - libssl-dev \ - libyaml-dev \ - openssl \ - valgrind \ - zlib1g-dev \ - && break - - sleep "$seconds" || exit 1 - done + tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \ + gcc-8 \ + libffi-dev \ + libgdbm-dev \ + libgmp-dev \ + libjemalloc-dev \ + libncurses5-dev \ + libncursesw5-dev \ + libreadline6-dev \ + libssl-dev \ + libyaml-dev \ + openssl \ + valgrind \ + zlib1g-dev - &clang-8 compiler: clang-8 addons: apt: - config: - retries: true + # Not doing this manually unlike other sources, because it has been stable. sources: - llvm-toolchain-xenial-8 - # `packages` are installed in `before_install` for retries. + config: + retries: true before_install: + - tool/travis_retry.sh bash -c "sudo rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && sudo apt-get update -yq" - |- - for seconds in 1 25 100 -1; do - travis_apt_get_update - - sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \ - clang-8 \ - llvm-8-tools \ - libffi-dev \ - libgdbm-dev \ - libgmp-dev \ - libjemalloc-dev \ - libncurses5-dev \ - libncursesw5-dev \ - libreadline6-dev \ - libssl-dev \ - libyaml-dev \ - openssl \ - valgrind \ - zlib1g-dev \ - && break - - sleep "$seconds" || exit 1 - done + tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \ + clang-8 \ + llvm-8-tools \ + libffi-dev \ + libgdbm-dev \ + libgmp-dev \ + libjemalloc-dev \ + libncurses5-dev \ + libncursesw5-dev \ + libreadline6-dev \ + libssl-dev \ + libyaml-dev \ + openssl \ + valgrind \ + zlib1g-dev # -------- @@ -290,35 +274,25 @@ env: https://github.com/ruby/ruby/blob/trunk/.travis.yml#L274 # sources: # - ubuntu-toolchain-r-test before_install: + - tool/travis_retry.sh sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" + - tool/travis_retry.sh bash -c "sudo rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && sudo apt-get update -yq" - |- - for seconds in 1 25 100 -1; do - sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break - sleep "$seconds" || exit 1 - done - - |- - for seconds in 1 25 100 -1; do - travis_apt_get_update - - sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \ - gcc-8-multilib \ - libffi-dev:i386 \ - libffi6:i386 \ - libgdbm-dev:i386 \ - libgdbm3:i386 \ - libncurses5-dev:i386 \ - libncurses5:i386 \ - libncursesw5-dev:i386 \ - libreadline6-dev:i386 \ - libreadline6:i386 \ - libssl-dev:i386 \ - libssl1.0.0:i386 \ - linux-libc-dev:i386 \ - zlib1g-dev:i386 \ - zlib1g:i386 \ - && break - - sleep "$seconds" || exit 1 - done + tool/travis_retry.sh sudo -E apt-get -yq --no-install-suggests --no-install-recommends $travis_apt_get_options install \ + gcc-8-multilib \ + libffi-dev:i386 \ + libffi6:i386 \ + libgdbm-dev:i386 \ + libgdbm3:i386 \ + libncurses5-dev:i386 \ + libncurses5:i386 \ + libncursesw5-dev:i386 \ + libreadline6-dev:i386 \ + libreadline6:i386 \ + libssl-dev:i386 \ + libssl1.0.0:i386 \ + linux-libc-dev:i386 \ + zlib1g-dev:i386 \ + zlib1g:i386 - &pedanticism name: -std=c99 -pedantic diff --git a/tool/travis_retry.sh b/tool/travis_retry.sh new file mode 100755 index 0000000..9b79c56 --- /dev/null +++ b/tool/travis_retry.sh @@ -0,0 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/tool/travis_retry.sh#L1 +#!/bin/sh -eu +# The modified version of `travis_retry` to support custom backoffs, which is used by .travis.yml. +# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_retry.bash + +for sleep in 0 ${WAITS:- 1 25 100}; do + sleep "$sleep" + + echo "+ $@" + if "$@"; then + exit 0 + fi +done +exit 1 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/