Score:0

Elastic Beanstalk deploying files that are in .ebignore / .gitignore

cn flag

I have a Drupal app that is deployed with Elastic Beanstalk from a Mac machine, using the latest version of the EB CLI. The repository is an ordinary GitLab, AWS CodeCommit is not used.

Unfortunately, if I don't religiously take care of running a rm -rf vendor before running eb deploy, it commits four files into the archive:

1980-01-01 00:00:00 .....           11           11  ./vendor/grasmash/yaml-expander/scenarios/symfony4/tests
1980-01-01 00:00:00 .....            9            9  ./vendor/grasmash/yaml-expander/scenarios/symfony4/src
1980-01-01 00:00:00 .....           11           11  ./vendor/grasmash/yaml-expander/scenarios/symfony2/tests
1980-01-01 00:00:00 .....            9            9  ./vendor/grasmash/yaml-expander/scenarios/symfony2/src

As a result, the deploy fails, with this error message in eb-engine.log:

2022/10/18 10:07:12.498904 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2022/10/18 10:07:12.768789 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2022/10/18 10:07:12.778754 [ERROR] An error occurred during execution of command [app-deploy] - [StageApplication]. Stop running the command. Error: chown /var/app/staging/vendor/grasmash/yaml-expander/scenarios/symfony2/src: no such file or directory

The .ebignore file is identical to .gitignore, and has a line

/vendor

so theoretically, eb deploy should not have added these four symlinks at all. There are no other files or folders from vendor in the archive. The files' UID, GID and modes are identical to other files in vendor that do not get end up deployed.

What causes this behavior?

Score:0
it flag

I just ran into a similar problem with a Python & Django application where suddenly a file link nested in node_modules - which is not being run or used during the deployment process - caused a failure with the same message no such file or directory during the deployment.

Based on the AWS EB CLI documentation, .gitignore is not used when .ebignore is present. I had the same patterns in both files, so I decided to simply delete the .ebignore file and now my application bundle reduced from 327 MB to just 24 MB. And the deploy was successful.

It could be that .ebignore interprets the rules slightly differently than .gitignore, which could perhaps explain the differences between the eb deploy runs.

This doesn't quite answer your question why the.ebignore did not work for you, but you could try deleting it, if all you need is already covered by .gitignore anyway.

Other than that, maybe your pattern needs to be adjusted, based on an example in the Git Documentation in chapter 2.2 Git Basics - Recording Changes to the Repository:

# only ignore the TODO file in the current directory, not subdir/TODO
/TODO

So, maybe the correct pattern for your use case is /vendor/.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.