Skip to content

Added support for ENGINE_MEMORY_LIMIT_BYTES

Sebastian Żmijewski requested to merge seb.zmi/codequality:master into master

What does this MR do?

This MR add support of ENGINE_MEMORY_LIMIT_BYTES in environment variables.

I tried to set up the code quality on a large PHP project with using phan plugin but after few tries, the job was always exiting with error code 137:

I, [2020-04-12T08:57:22.420651 #1]  INFO -- : starting engine phan
D, [2020-04-12T08:57:22.420944 #1] DEBUG -- : /config.json content: {"enabled"=>true, "config"=>{"file_extensions"=>"php"}, "channel"=>"stable", "include_paths"=>[".codeclimate.yml", ".rubocop.yml", "package.json", ".eslintignore", ".gitignore", "config/", "symfony.lock", ".gitlab-ci.yml", "docker-compose.yml", ], "debug"=>"1"}
D, [2020-04-12T08:57:22.421882 #1] DEBUG -- : docker run: ["docker", "run", "--name", "cc-engines-phan-stable-", "--cap-drop", "all", "--label", "com.codeclimate.label=", "--log-driver", "none", "--memory-swap", "-1", "--net", "none", "--rm", "--volume", "/builds/backend:/code:ro", "--volume", "/tmp/cc/:/config.json:ro", "--user", "9000:9000", "--memory", "1024000000", "codeclimate/codeclimate-phan"]
I, [2020-04-12T08:59:44.580278 #1]  INFO -- : finished engine phan
error: (CC::CLI::Analyze::EngineFailure) engine phan failed with status 137 and stderr 

I resolved the problem by copying the run.sh with adding the changes in MR and overwriting the entrypoint in docker job:

   - docker run
      --entrypoint="/code/.codeclimate-run.sh"
      --env ENGINE_MEMORY_LIMIT_BYTES="6144000000"

Maybe not only I have a similar problem and it will help someone.

Thanks for great work!

What are the relevant issue numbers?

cc @drewcimino @iamricecake @morefice

Merge request reports