0
votes

On 3 of my 6 Swisscom CloudFoundry spaces i get the following error when deploying with the same (custom) buildpack.

Starting app my-app-name in org my-org /               space my-space as [email protected]...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (26M)
Staging...
exec: "git": executable file not found in $PATH
Exit status 1
Staging failed: Exited with status 1

FAILED
StagingError

I am using the following buildpack in the manifest.yml:

---
buildpack: https://github.com/shiftcode/java-buildpack-mongodb
domain: scapp.io
path: target/my-app-name.zip
disk_quota: 1024M
domains:
  - scapp.io
services:
 - my-service-one
 - my-service-two
 ...

env:
   JBP_CONFIG_OPEN_JDK_JRE : '[jre: {version: 1.8.0_+}, memory_calculator: {memory_heuristics: {heap: 35, metaspace: 30, stack: 5, native: 30}}]'
   MONGO_DB_VERSION : '3.2.0'
   MONGODB_CMD_PATH : '.mongo/bin/'
   MONGODB_MAX_POOLSIZE : '1'
   MALLOC_ARENA_MAX : '2'
   MALLOC_MMAP_THRESHOLD_ : '131072'
   MALLOC_TRIM_THRESHOLD_ : '131072'
   MALLOC_TOP_PAD_ : '131072'
   MALLOC_MMAP_MAX_ : '65536'

# app specific configuration
applications:
- name: my-app-name-development
  memory: 512M
  instances: 2
  host: my-app-name-development

- name: my-app-name-staging
  memory: 512M
  instances: 2
  host: my-app-name-staging

This buildpack extends the normal java-buildpack by adding a mongodb installation (we use the mongodump command for backups). The same buildpack with the same code and same manifest.yml settings works on some spaces but not others. I have tried deleting the app before pushing again without success. I have ssh access (diego) enabled on all spaces and apps.

Any ideas on why the git executable is not available while staging and how to fix this or have it fixed? I would like to avoid the hassle (and cost) of deleting the spaces and recreating them.

4
please edit your posting with your Manifest.yml used. It seems that Cloud Foundry thinks you are using the GO buildpack instead of Java buildpack. Also in developer portal it show the GO logo. The error exec: "git": executable file not found in $PATH comes from GO buildpack. - Josefine
I have updated the manifest.yml. But even if cloudfoundry thinks I am using the GO buildpacks how can it be that the exact same thing works on other spaces? Same thing happens on the "bad" spaces when i use the build pack from https://github.com/cloudfoundry/java-buildpack or the provided java_buildpack which results in exec: "tar": executable file not found in $PATH. - Patrick Suter

4 Answers

2
votes

This is an issue with the garden-runc containerization technology in Cloud Foundry versions 0.7.0 and earlier. As surmised by the accepted answer, if an env variable contained the string "PATH", there is a bug in Garden that sets the PATH incorrectly.

This has been resolved since garden-runc release 0.8.0. You can find the associated story worked on here:

https://www.pivotaltracker.com/story/show/129773615

and the commit that fixes this issue here:

https://github.com/cloudfoundry/guardian/commit/e191b2ca8365f44c812cb8feb70c722391886063

The workaround for this issue to is to set another env variable for your app:

PATH: /usr/local/bin:/usr/bin:/bin

1
votes

This is a recently logged bug. See https://www.pivotaltracker.com/n/projects/1158420/stories/129773615

For now, you have to use workarounds to remove or mangle *PATH entries.

0
votes

After a lot of fiddling around with the env variables i found out that the problem was with the MONGODB_CMD_PATH env variable from my manifest.yml. It seems that any env variable ending on PATH influences/overrides the $PATH env causing the staging process to fail because the required executables are no longer on the system path.

0
votes

I had the same problem, and the accepted answer worked for me. The following is for the benefit of Googlers:

I was setting the PYTHONPATH variable in my manifest. CloudFoundry was correctly setting the PYTHONPATH env var, but it was also using it to overwrite the PATH variable. The workaround for me was to set the PYTHONPATH to $PATH:/my/python/path. While that adds extraneous directories to both PATH and PYTHONPATH, it functions as expected.