Job failed with exit status 1 without any error

I’m trying to create a runner setup script using the GitLab CI pipeline. Here, I registered the executor as shell and planning to run an initial pipeline that set up the runner machines with all the required installations. I need to build flutter APKs using the pipeline.

Everything is working except a command to accept Android licenses using flutter. I’m getting the response which says:

All SDK package licenses accepted

But the job’s status is failed. Not sure what causes this to fail. This command is working in the machine (directly) without any issues.
This is the .gitlab-ci.yml code

    - flutter

  stage: configuration

    # Accept Licenses
    - yes | flutter doctor --android-licenses

    - if: $CI_COMMIT_BRANCH == "devops1"
      when: always

This is the error message:

How can I troubleshoot and find the issue? Please help.

Hi @neron_joseph
Runner is dependent on the exit code of the command. If the exit code is other than ‘0’ it is considered as failed.
You can check locally what exit code is returned by that command my_command; echo $?

Hi @balonik, when I run the command from the terminal. I’m getting the exit code as ‘0’. This is the screenshot.

But when I tried the same via GitLab CI, the job failed. Screenshot below:
Screenshot from 2021-06-20 06-35-19

In that case I would look at the next command in the script.

Actually, I have tried creating a separate job with only the above command in order to avoid job failure on other commands. In that case, also, it failed.

The last screenshot that I’ve shared has only this command in that job:

yes | flutter doctor --android-licenses; echo $?