Search code examples
gitcloud-foundryswisscomdev

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.


Solution

  • 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