1

We have a CI server that automatically runs our tests. Everything works great except this morning a build was pushed up that when "phpunit" ran it hit some bad php syntax which exited the below execution chain so that artisan ci:cleanup was never run.

php artisan ci:prepare
./vendor/bin/phpunit
php artisan ci:cleanup

The tail end of GitLab-CI's log output is below, showing that this parse error prevented the cleanup from running.

./vendor/bin/phpunit
PHP Parse error:  syntax error, unexpected '<<' (T_SL) in /home/gitlab_ci_runner/gitlab-runners/gitlab-ci-runner/tmp/builds/project-9/app/lib/Tests/Shared/Controllers/Api/AuthTest.php on line 64

I'd prefer to avoid writing a bash file or something to handle execution/errors, but I still need for the output to show in GitLab-CI's logs as it normally does.

How should I best approach handling this kind of terminating error where it doesn't prevent the cleanup from running?

Ben
  • 60,438
  • 111
  • 314
  • 488
  • What is preventing the next command from running if this command exits unsuccessfully? Is there something like a shell's `set -e`? – glenn jackman May 01 '14 at 13:23

1 Answers1

0

One (fairly hacky) way of working around this is to add || true to the end of the command. eg:

./vendor/php/phpunit || true

This should get around any error trapping in place.

pgl
  • 7,551
  • 2
  • 23
  • 31