cloudfoundry / cli

The official command line client for Cloud Foundry
https://docs.cloudfoundry.org/cf-cli
Apache License 2.0
1.75k stars 927 forks source link

cf create-buildpack mangles CF buildpack contents when called with a directory #1379

Closed sclevine closed 6 years ago

sclevine commented 6 years ago

The cf create-buildpack command is usually called with a zip file, but it can also be called with a directory that contains the contents of a buildpack. Currently, the command skips the buildpack's manifest.yml file when zipping it up. This manifest.yml file is distinct from an app manifest.yml, and is necessary for all of the CF buildpacks to function.

Command

cf create-buildpack my_buildpack ./my-buildpack-directory 1

What occurred

The manifest.yml file at the root of the buildpack is not available because the same code used to zip apps is used to zip the buildpack. This makes all of the official CF buildpacks fail with an opaque error message that is difficult to debug:

   Downloaded app package (68K)
   -----> Download go 1.9.1
   -----> Running go build supply
Error staging application: App staging failed in the buildpack compile phase
FAILED

What you expected to occur

The buildpack to be uploaded without any missing files.

Maybe .git and other VCS directories should be excluded though? The manifest.yml file is actually the only one that seems unreasonable to remove: https://github.com/cloudfoundry/cli/blob/master/cf/appfiles/cf_ignore.go#L80

Is there a reason we don't upload the manifest.yml file for apps?

Any other relevant information

See: https://pivotal.slack.com/archives/C05692KCR/p1525979858000109

cf-gitbot commented 6 years ago

We have created an issue in Pivotal Tracker to manage this:

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

The labels on this github issue will be updated when the story is started.

vitreuz commented 6 years ago

This is an unfortunate side-effect of the legacy code removing app manifests for security reasons (See #137). This will be handled when we refactor the command.

abbyachau commented 6 years ago

HI @sclevine we've confirmed that the refactor fixed this issue and will be releasing this in the upcoming release. Let us know if you have any additional questions/comments by reopening this issue or creating a new one. Thanks.