Different Return Code on Gitlab-CI compared to manual execution
Summary
Executing a PHP script in a container pulled from image php:7.1 yields in the following error:
$ php yii api > api.json
ERROR: Job failed: exit code 1
Running the same script on the same image manually however works and yields an exit code of 0. I've simplified the .gitlab-ci.yml
file as much as possible
Steps to reproduce
The following .gitlab-ci.yml
file is used:
stages:
- api_json
api_json:
stage: api_json
image: php:7.1
script:
- ls -al
- php yii api > api.json
only:
- development
Running this locally works:
$(host): docker run -it --rm -v $(pwd):/builds -w /builds php:7.1 bash
root@55837e40e6bf:/builds# php yii api > api.json
root@55837e40e6bf:/builds# echo $?
0
root@55837e40e6bf:/builds# ls -al | grep api.js
-rw-r--r-- 1 root root 62333 Mar 10 09:50 api.json
Actual behavior
Code exits with error code 1 and pipeline fails
Expected behavior
Code should exit with code 0 and pipeline should continue to next step
Relevant logs and/or screenshots
Running with gitlab-runner 11.8.0 (4745a6f3)
on docker-auto-scale ed2dce3a
Using Docker executor with image php:7.1 ...
Pulling docker image php:7.1 ...
Using docker image sha256:ee429d157a7c31ed743d7b4d18ef5da8393ecba0dc1900487d0338a67ef575ba for php:7.1 ...
Running on runner-ed2dce3a-project-9096458-concurrent-0 via runner-ed2dce3a-srm-1552210993-aa8ce9ee...
Cloning repository...
Cloning into '/builds/my-group/my-project'...
Checking out f914d13b as development...
Skipping Git submodules setup
$ ls -al
total 492
[...output cut...]
drwxrwxrwx. 14 root root 4096 Mar 10 09:52 views
drwxrwxrwx. 5 root root 4096 Mar 10 09:52 web
-rwxrwxrwx. 1 root root 697 Mar 10 09:52 yii
$ php yii api > api.json
ERROR: Job failed: exit code 1
Environment description
Are you using shared Runners on GitLab.com? Yes php7.1 image as described above
Used GitLab Runner version
Running with gitlab-runner 11.8.0 (4745a6f3)
on docker-auto-scale ed2dce3a
Using Docker executor with image php:7.1 ...
Edited by Daniel Herrmann