GitLab: rm: can't remove '/srv/app': No such file or directory

Hi all,

using the default template of sonarcloud in my CI/CD:

  stage: test
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
    key: "${CI_JOB_NAME}"
      - .sonar/cache
    - sonar-scanner
  allow_failure: true
    - merge_requests
    - master
    - develop

I receive the following error:
Preparing environment


[171]( on runner-fa6cab46-project-19395361-concurrent-0 via runner-fa6cab46-srm-1597699190-4673133f...

[173]( source from Git repository


[174]($ eval "$CI_PRE_CLONE_SCRIPT"

[175]( changes...

[176]( empty Git repository in /builds/wdp-adma/adma-poc/.git/

[177]( fresh repository.

[178]( out 888c6f2c as refs/merge-requests/52/head...

[179]( Git submodules setup

[181]( cache


[182]( cache for test:sonarcloud-check...

[183]( file does not exist

[184]( to extract cache

[186]( artifacts


[187]( artifacts for build (690394198)...

[188]( artifacts from coordinator... ok id=690394198 responseStatus=200 OK token=zAdd2w27

[190]( "step_script" stage of the job script


[191]($ rm -r /srv/app

[192]( can't remove '/srv/app': No such file or directory

[194]( Job failed: exit code 1

I like to deploy laravel + vue application.

Any idea how to fix that? Thank you very much!

Locally running the project with docker works fine
docker run --rm -e SONAR_HOST_URL="" -v "$(pwd):/usr/src" sonarsource/sonar-scanner-cli

1 Like

Hello Simon
and welcome to SonarSource community!

When I see those logs:

[190]( "step_script" stage of the job script
[191]($ rm -r /srv/app

I believe there is something wrong with this pipeline. With the default pipeline code you quoted, the first command called on the scanner container is sonar-scanner and not some rm command.

Executing "step_script" stage of the job script 
$ sonar-scanner

Do you know where this rm command could come from?

Best regards

1 Like

Dear Sylvain, thank you for the follow up. Actually I have no clue where this comes from. I use the official docker image and just the default lines as desribed above. Thought it comes from the docker image, dosen’t it?

Hello Simon
this rm command does not come from the SonarQube docker image, or at least not directly, as you can check from its code.

I tried to reproduce with this same pipeline on some sample gitlab repo and it worked ok for me. My guess is that either this pipeline for which you get this error is running some other pipeline definition file, or some script is injected in the pipeline execution path(but where?).
As next step I would check this project branch content and the file there.

1 Like

Oh… you are so right. Thank you! Topic solved and spotted the “rm -r” in a before_script…

1 Like

Glad you solved this mystery!
Thanks for letting us know.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.