Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push fails with an empty directory #687

Closed
benmoss opened this issue Nov 19, 2015 · 22 comments
Closed

push fails with an empty directory #687

benmoss opened this issue Nov 19, 2015 · 22 comments

Comments

@benmoss
Copy link

benmoss commented Nov 19, 2015

it used to fail somewhat helpfully with:

$ cf --version
cf version 6.12.4-b4b6af1-2015-09-18T17:54:54+00:00
$ cf push foo -p foo/
Updating app foo in org org / space space as admin...
OK

Uploading foo...
Done uploading
FAILED
Error uploading application.
The app package is invalid: Could not zip the package
 STDOUT: "
zip error: Nothing to do! (try: zip -q -r --symlinks /var/vcap/data/cloud_controller_ng/tmp/safezipper20151119-2484-1trdr3z/package.zip . -i .)
"
 STDERR: ""

now:

$ cf --version
cf version 6.14.0+2654a47-2015-11-18

$ cf push foo -p foo/
Updating app foo in org org / space space as admin...
OK

Uploading foo...
FAILED
Error uploading application.
Server error, status code: 500, error code: 10001, message: An unknown error occurred.
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/108559196.

@dkoper
Copy link

dkoper commented Nov 19, 2015

Thanks Ben, we'll investigate.

@krishicks
Copy link
Contributor

This change was introduced in 2b77387. json.Marshal is being given an uninitialized type rather than an initialized, empty type, thus it gives us "null" instead of "{}".

@simonleung8 and I think the best solution here would be to change the bug in Tracker to a feature (which we've done), and then solve this problem by checking the count of files before we even attempt the upload, failing if there is nothing to upload, and printing a helpful message.

@dkoper
Copy link

dkoper commented Dec 9, 2015

Hi Ben,

We have made it to return a helpful message again:

FAILED
No app files found in 'C:\Users\diesk\Downloads\t'

It's in our edge binary, will go into our next release.

Regards,
Dies Koper
CF CLI PM

@dkoper
Copy link

dkoper commented Dec 23, 2015

This fix is included in cf CLI release v6.14.1 published today.
https://github.com/cloudfoundry/cli#downloads

@mfeltscher
Copy link

Hi

I want to reopen this issue since I encountered a similar problem while trying to push an app using CLI v6.14.1.
We're using staticfile-buildpack to publish some static sites. The buildpack gives you the option to configure your root folder using a sub directory in your app directory. Therefore we adjusted our .cfignore to ignore everything except the sub directory we want to publish. The change introduced in 2b77387 now always throws an error if we want to publish that app since it's only looking for files (see

if len(localFiles) == 0 {
cmd.ui.Failed(
T("No app files found in '{{.Path}}'",
map[string]interface{}{
"Path": *appParams.Path,
}),
)
}
), not directories. Could you adjust that check to also see if there are any directories and therefore the app isn't empty?

Thanks
Moreno

@krishicks
Copy link
Contributor

Hi @mfeltscher,

What is the structure of your app dir? The output from tree would be helpful.

@mfeltscher
Copy link

Hi @krishicks
Output of tree:

.
├── README.md
├── Staticfile
├── bin
├── bower_tmp
├── ch.migros.cdn.iml
├── composer.json
├── composer.lock
├── deploy
├── gulpfile.js
├── gulptasks
├── manifest.yml
├── nginx.conf
├── node_modules
├── package.json
├── release
├── static
└── vendor

The folder we want to expose is release

@krishicks
Copy link
Contributor

What are you running to push the app?

@krishicks
Copy link
Contributor

@jtarchie Can you provide some insight into this usage of the static buildpack? I'm not sure what the expectation is of what's actually being pushed.

@mfeltscher
Copy link

I'm running cf push <app-name> -f manifest.yml -n <app-name.host> -d <domain> --no-start

@mfeltscher
Copy link

By the way, that's the content of my Staticfile:

directory: visible
root: release

@krishicks
Copy link
Contributor

What path is the manifest pointing to?

@mfeltscher
Copy link

Nothing special in there:

---
applications:
    - name: <app-name>
      buildpack: staticfile_buildpack
      instances: 2
      memory: 64M
      disk_quota: 2GB

@jtarchie
Copy link

@mfeltscher the staticfile_buildpack needs to have access to Staticfile, as the buildpack staging process remotely on your CF deployment.

Do you have Staticfile in your .cf_ignore?

@mfeltscher
Copy link

Yes, my (not working with CLI v6.14.1 anymore) .cfignore used to look like this:

*
!/release/*
!/Staticfile*

As said, this used to work with older versions of the CLI just fine.

Back to my initial request: Would it be possible, to extend the check for files to also include directories? This would fix my issue.

@jtarchie
Copy link

Please don't include Staticfile in your .cf_ignore file. I think this only previously worked because of a bug, where excluding files with .cf_ignore was not working correctly. The buildpack needs Staticfile for the meta information for staging.

@mfeltscher
Copy link

This is what ! is doing - preventing Staticfile from being excluded, isn't it?

@jtarchie
Copy link

I'm sorry, just noticed that it has !. I'm not actually familiar with that syntax in .cf_ignore. My apologies.

Maybe a different approach. Instead of trying to find the right combination of include/exclude directives. Is it possible to generate the Staticfile in the releases dir and then push up that directory as your path?

@mfeltscher
Copy link

This would actually be possible but I still don't really like that solution. As said, why can't an app just consist of directories and no files?

@krishicks
Copy link
Contributor

I feel the slash in the .cfignore for StaticFile should not be there (e.g. !StaticFile). See https://github.com/cloudfoundry/cli/blob/master/cf/app_files/cf_ignore_test.go#L36.

@mfeltscher
Copy link

Doesn't work either way. The slash only ensures that the file has to match a file in root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants