Patrick Suter Patrick Suter - 3 months ago 70
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 user@company.com...
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.

Answer

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).

Comments