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

.ebignore doesn't strictly follow .gitignore syntax #114

Open
ZYinMD opened this issue May 10, 2022 · 6 comments
Open

.ebignore doesn't strictly follow .gitignore syntax #114

ZYinMD opened this issue May 10, 2022 · 6 comments

Comments

@ZYinMD
Copy link

ZYinMD commented May 10, 2022

Description

In .gitignore (doc), /* means "everything, including folders, in the root path relative to the .gitignore file".

This is a good starting point to construct a "whitelist" where you use ! to include only the files you want.

However, it seems /* in .ebignore won't ignore folders.

Steps to reproduce

Create a folder structure like this:

root
  |--.git/
  |--node_modules/
  |    |--deps/
  |    |--useless-dev-deps/
  |--some-other-folder/
  |    |--other-folder-content.txt
  |--server.js
  |--package.json
  |--README.md
  |--.ebignore

Then construct a whitelist with .ebignore:

# start off by ignoring everything
\*

# other than these 2 files, nothing else is required for this deployment to work 
!server.js
!package.json

Then deploy with eb deploy, then inspect the zip file in eb console.

Observed result

  1. README.md is successfully ignored
  2. .git, node_modules, and some-other-folder are included in the zip.

Expected result

If .ebignore works the same way as .gitignore, .git, node_modules, and some-other-folder shouldn't be zipped.

(irrelevant note: Google App Engine has an equivalent .gcloudignore file, which behaves consistently with this "expected result")

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Win10
  2. EBCLI version: 3.20.3 (Python 3.9.6)
@ZYinMD
Copy link
Author

ZYinMD commented May 10, 2022

There's actually some additional bizarre behavior regarding node_modules, which I can describe in another issue.

@littleforest
Copy link

I am also encountering this behavior:

# .ebignore

...
/storage/*
!/storage/.keep
...

Results in:

$ eb deploy -v
INFO:   +adding: ./storage/v6/oc/v6oc5ko1eembqt1u2mr25mii4iue
INFO:  +adding: ./storage/9y/xi/
INFO:   +adding: ./storage/9y/xi/9yxi0znpqwrgkdksewg4vhl1bsek
INFO:  +adding: ./storage/92/1d/
INFO:   +adding: ./storage/92/1d/921d0jwhly08qf1s0w0m5zsqsc62
INFO:  +adding: ./storage/sb/9p/
INFO:   +adding: ./storage/sb/9p/sb9pq7tlrfj0okgkx9p18ify2vjx
INFO:  +adding: ./storage/u7/yp/
INFO:   +adding: ./storage/u7/yp/u7yp9aw60q2x3u3gstmbsm6regdp
INFO:  +adding: ./storage/z3/xb/

But

# .ebignore

...
/storage
...

results in:

INFO:   -skipping: ./storage/v6/oc/v6oc5ko1eembqt1u2mr25mii4iue
INFO:   -skipping: ./storage/9y/xi/9yxi0znpqwrgkdksewg4vhl1bsek
INFO:   -skipping: ./storage/92/1d/921d0jwhly08qf1s0w0m5zsqsc62
INFO:   -skipping: ./storage/sb/9p/sb9pq7tlrfj0okgkx9p18ify2vjx
INFO:   -skipping: ./storage/u7/yp/u7yp9aw60q2x3u3gstmbsm6regdp
INFO:   -skipping: ./storage/z3/xb/z3xbickjxkyvjoqwk8w63wfgmsw1
INFO:   -skipping: ./storage/3e/89/3e89reffzp4sqb1xmiix6jj1qmrl
INFO:   -skipping: ./storage/se/84/se84y8itgkufezud31r7y3ccaz95
INFO:   -skipping: ./storage/yw/67/yw67vz7yrxioq2p08alxft9s9z4e
INFO:   -skipping: ./storage/6f/6c/6f6c7d3xbh1tr1vpj6cgz11v1wj8
INFO:   -skipping: ./storage/sw/z7/swz7royzygltiea1z0j3gg2nxd21
INFO:   -skipping: ./storage/9b/vu/9bvutzmdpg46crtct1dsakp6igpj

@Parker-Bergen
Copy link

Parker-Bergen commented Dec 1, 2022

I am having this exact issue, but I have permission issues on some files that should be ignored. The folder shouldn't even be entered if ignored

@NihalM99
Copy link
Contributor

NihalM99 commented Oct 25, 2023

Hi @ZYinMD are you still facing the issue ? I was able to do eb deploy and it seemed to work as expected . My folder structure :

root1]$ ls -la 
total 32
drwxr-xr-x 6  amazon 4096 Oct 25 22:21 .
drwxr-xr-x 4  amazon 4096 Oct 25 22:17 ..
-rw-r--r-- 1 amazon   15 Oct 25 22:21 .ebignore
drwxr-xr-x 2  amazon 4096 Oct 25 22:22 .elasticbeanstalk
drwxr-xr-x 7  amazon 4096 Oct 25 22:22 .git
-rw-r--r-- 1  amazon  108 Oct 25 22:20 .gitignore
drwxr-xr-x 4  amazon 4096 Oct 25 22:18 node_modules
-rw-r--r-- 1  amazon    0 Oct 25 22:18 package.json
-rw-r--r-- 1  amazon    0 Oct 25 22:18 README.md
-rw-r--r-- 1  amazon    0 Oct 25 22:18 server.js
drwxr-xr-x 2  amazon 4096 Oct 25 22:18 some-other-folder

.ebignore looks like :

/*

!server.js

This is part of the eb deploy --verbose output , which shows that it is skipping everything except server.js as mentioned in the .ebignore file

eb deploy --verbose
INFO: Deploying code to roottest in region us-east-1
INFO: Getting version label from git with git-describe
Creating application version archive "app-364d-231025_222737283834".
INFO: Found .ebignore, using system zip.
INFO: Zipping up folder at location: /local/home/test114/root1
INFO:   -skipping: ./.ebignore
INFO:   -skipping: ./README.md
INFO:   -skipping: ./package.json
INFO:  +adding: .//
INFO:   +adding: ./server.js
INFO:   -skipping: ./.gitignore
INFO:   -skipping: ./.elasticbeanstalk
INFO:   -skipping: ./.elasticbeanstalk/app_versions
INFO:   -skipping: ./some-other-folder/other-folder-content.txt
INFO:   -skipping: ./.git/HEAD
INFO:   -skipping: ./.git/config
INFO:   -skipping: ./.git/description
INFO:   -skipping: ./.git/COMMIT_EDITMSG
INFO:   -skipping: ./.git/index
INFO:   -skipping: ./.git/logs/HEAD
INFO:   -skipping: ./.git/logs/refs/heads/master
INFO:   -skipping: ./.git/info/exclude
INFO:   -skipping: ./.git/hooks/applypatch-msg.sample
INFO:   -skipping: ./.git/hooks/pre-push.sample
INFO:   -skipping: ./.git/hooks/pre-rebase.sample
INFO:   -skipping: ./.git/hooks/pre-commit.sample
INFO:   -skipping: ./.git/hooks/pre-merge-commit.sample
INFO:   -skipping: ./.git/hooks/fsmonitor-watchman.sample
INFO:   -skipping: ./.git/hooks/update.sample
INFO:   -skipping: ./.git/hooks/sendemail-validate.sample
INFO:   -skipping: ./.git/hooks/pre-receive.sample
INFO:   -skipping: ./.git/hooks/pre-applypatch.sample
INFO:   -skipping: ./.git/hooks/prepare-commit-msg.sample
INFO:   -skipping: ./.git/hooks/push-to-checkout.sample
INFO:   -skipping: ./.git/hooks/commit-msg.sample

zipinfo on the uploaded application file is as follows :

zipinfo app-364d-231025_222211818947
Archive:  app-364d-231025_222211818947.zip
Zip file size: 198 bytes, number of entries: 2
drwxr-xr-x  2.0 unx        0 b- stor 23-Oct-25 22:21 ./
-rw-r--r--  2.0 unx        0 b- defN 23-Oct-25 22:18 server.js

OS: Amazon Linux 2
EB-CLI Version : 3.20.10
Git version :2.42.0

Also , there seems to be an issue with Pathspec in windows cpburnz/python-pathspec#81

@ZYinMD
Copy link
Author

ZYinMD commented Oct 26, 2023

Hi @NihalM99 , I'm not currently using eb (1.5 years after filing this issue), sorry I don't have an answer from personal experience, but I hope it's already fixed as you've found!

@cpburnz
Copy link

cpburnz commented Dec 9, 2023

@NihalM99 I see you referenced bug cpburnz/python-pathspec#81. This is now fixed in the v0.12.0 release of pathspec.

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

5 participants