Travis: failed build reported as successful

Mojca Miklavec mojca at macports.org
Sat Jul 1 07:28:13 UTC 2017


On 1 July 2017 at 09:21, Mojca Miklavec wrote:
> On 1 July 2017 at 09:04, Zero King wrote:
>> On Sat, Jul 01, 2017 at 07:51:12AM +0200, Mojca Miklavec wrote:
>>>
>>> I tried to figure out where you call (anything that calls) portindex,
>>> but no luck :).
>>
>> https://github.com/macports/macports-ports/blob/master/_ci/bootstrap.sh#L18
>
> I would say that
>     portindex || exit 1
> should work.
>
> When individual steps could fail and when I wanted to proceed
> executing the script to the end, I usually wrote a function that
> checked for failure status and only reported / generated a failure at
> the end.

Something like this:

run_cmd_nonfatal() {
  text="$1"
  shift
  if ! "$@"; then
    failures="$failures\n  - $text"
    return 1
  fi
  return 0
}

run_cmd_fatal() {
  text="$1"
  shift
  if ! "$@"; then
    echo "ERROR: $text"
    exit 1
  fi
  return 0
}

run_cmd_fatal "run portindex" portindex

But I don't know what exactly you want to do when an individual step fails.

Mojca


More information about the macports-dev mailing list