Kunstmaan / kStrano

kStrano (KumaStrano) is a Capistrano deployment “recipe” for Kunstmaan specific applications to make our job of deploying a lot easier. It integrates with Airbrake, Jenkins and Campfire.
MIT License
13 stars 0 forks source link

ignore file mode changes in vendor folder for composer install #42

Closed jockri closed 10 years ago

jockri commented 11 years ago

After you run fixperms.py for a specific Symfony2 project, you can have problems while deploying a new version. The fixperms.py is going to change the file permissions in the vendor folder to (set file mode to 755). When running a composer install, you get errors because you have "uncomitted changes".

Deploy log:

...
** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] Composer successfully installed to: /home/projects/kumabundlesite/data/releases/20130807085522/composer.phar
 ** [out :: one.staging.kunstmaan.be] Use it: php composer.phar
    command finished in 21076ms
--> Installing Composer dependencies
  * executing "sudo -p 'sudo password: ' -u kumabundlesite sh -c 'cd /home/projects/kumabundlesite/data/releases/20130807085522 && php composer.phar install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress --no-interaction'"
    servers: ["one.staging.kunstmaan.be"]
    [one.staging.kunstmaan.be] executing command
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] Loading composer repositories with package information
 ** [out :: one.staging.kunstmaan.be] Installing dependencies from lock file
 ** [out :: one.staging.kunstmaan.be] - Removing phpunit/php-token-stream (1.1.5)
 ** [out :: one.staging.kunstmaan.be] - Installing phpunit/php-token-stream (1.2.0)
 ** [out :: one.staging.kunstmaan.be] Downloading
 ** [out :: one.staging.kunstmaan.be] Extracting archive
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] - Removing phpunit/php-timer (1.0.4)
 ** [out :: one.staging.kunstmaan.be] - Installing phpunit/php-timer (1.0.5)
 ** [out :: one.staging.kunstmaan.be] Downloading
 ** [out :: one.staging.kunstmaan.be] Extracting archive
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] - Removing phpunit/phpunit (3.7.22)
 ** [out :: one.staging.kunstmaan.be] - Installing phpunit/phpunit (3.7.23)
 ** [out :: one.staging.kunstmaan.be] Downloading
 ** [out :: one.staging.kunstmaan.be] Extracting archive
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] - Updating kunstmaan/media-bundle dev-master (4af7d6b => 0e45347)
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be]                                                                                
 ** [out :: one.staging.kunstmaan.be]   [RuntimeException]                                                           
 ** [out :: one.staging.kunstmaan.be]   Source directory /home/projects/kumabundlesite/data/releases/20130807085522  
 ** [out :: one.staging.kunstmaan.be]   /vendor/kunstmaan/media-bundle/Kunstmaan/MediaBundle has uncommitted change  
 ** [out :: one.staging.kunstmaan.be]   s.                                                                           
 ** [out :: one.staging.kunstmaan.be]                                                                                
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] 
 ** [out :: one.staging.kunstmaan.be] Exception trace:
 ** [out :: one.staging.kunstmaan.be] () at phar:///home/projects/kumabundlesite/data/releases/20130807085522/composer.phar/src/Composer/Downloader/VcsDownloader.php:160
 ** [out :: one.staging.kunstmaan.be] Composer\Downloader\VcsDownloader->cleanChanges() at phar:///home/projects/kumabundlesite/data/releases/20130807085522/composer.phar/src/Composer/Downloader/GitDownloader.php:121
 ** [out :: one.staging.kunstmaan.be] Composer\Downloader\GitDownloader->cleanChanges() at
...

Log when running git status for this package:

[10:55:13][kumabundlesite@one ~/.../node-bundle/Kunstmaan/MediaBundle](master *)$ git diff
diff --git a/.gitignore b/.gitignore
old mode 100644
new mode 100755
diff --git a/.travis.yml b/.travis.yml
old mode 100644
new mode 100755
diff --git a/AdminList/NodeAdminListConfigurator.php b/AdminList/NodeAdminListConfigurator.php
old mode 100644
new mode 100755
diff --git a/Changelog.md b/Changelog.md
old mode 100644
new mode 100755
...

It would be nice that composer ignores those changes, or fixperms.py does not change the file mode in the vendors folder.

jverdeyen commented 11 years ago

git can resolve this issue: git config core.filemode false

kimausloos commented 11 years ago

@jverdeyen It is not possible to do it system wide, so it has to be done for every new git repo you clone or create.

There are some snippets on http://gitfilemodeisannoying.com/ to fix this, maybe we can run them during the deploy?

designermonkey commented 5 years ago

"post-install-cmd": "find . -type d -name .git -exec git --git-dir='{}' config core.filemode false \\;"