Bad AND shell evaluation in docker runner

Summary

When trying to execute two shell commands with &&, if the first one fails, gitlab-runner will continue to run.

Steps to reproduce

mkdir dir

Make this .gitlab-ci.yml file in dir:

some-job:
    image: alpine
    script:
      - ls MISSING && echo hello
      - echo world

Then run it using

cd dir
git init
git commit -am "Initial commit"
git commit --allow-empty -m "foo"
sudo gitlab-runner exec docker some-job

What is the current bug behavior?

Gitlab short circuits and doesn't execute echo hello, however it continues to execute echo world

What is the expected correct behavior?

Gitlab should terminate immediately since the first command failed, shouldn't execute neither echo hello nor echo world

Output of checks

This bug happens in GitLab Runner 12.0.1

Git Revision: 0e5417a3 GO version: go1.8.7 Built: 2019-06-26T15:02:39+0000 OS/Arch: Linux/amd64

Ran on Ubuntu 16.04

Edited by rinslow