Patrick Suter Patrick Suter - 1 year ago 367
Git Question

CloudFoundry staging error exec: "git": executable file not found in $PATH

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
Creating container
Successfully created container
Downloading app package...
Downloaded app package (26M)
exec: "git": executable file not found in $PATH
Exit status 1
Staging failed: Exited with status 1


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

path: target/
disk_quota: 1024M
- my-service-one
- my-service-two

JBP_CONFIG_OPEN_JDK_JRE : '[jre: {version: 1.8.0_+}, memory_calculator: {memory_heuristics: {heap: 35, metaspace: 30, stack: 5, native: 30}}]'
MONGODB_CMD_PATH : '.mongo/bin/'
MALLOC_TOP_PAD_ : '131072'
MALLOC_MMAP_MAX_ : '65536'

# app specific configuration
- 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
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.

Answer Source

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.

Looks like they have been incrementally distributing updates causing this (new) behaviour since not all my spaces are affected (yet).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download