{"action":"created","issue":{"url":"https://api.github.com/repos/ansistrano/deploy/issues/204","repository_url":"https://api.github.com/repos/ansistrano/deploy","labels_url":"https://api.github.com/repos/ansistrano/deploy/issues/204/labels{/name}","comments_url":"https://api.github.com/repos/ansistrano/deploy/issues/204/comments","events_url":"https://api.github.com/repos/ansistrano/deploy/issues/204/events","html_url":"https://github.com/ansistrano/deploy/issues/204","id":203580460,"node_id":"MDU6SXNzdWUyMDM1ODA0NjA=","number":204,"title":"Git deployment can´t handle nested subdirectories","user":{"login":"udotelaar","id":657194,"node_id":"MDQ6VXNlcjY1NzE5NA==","avatar_url":"https://avatars2.githubusercontent.com/u/657194?v=4","gravatar_id":"","url":"https://api.github.com/users/udotelaar","html_url":"https://github.com/udotelaar","followers_url":"https://api.github.com/users/udotelaar/followers","following_url":"https://api.github.com/users/udotelaar/following{/other_user}","gists_url":"https://api.github.com/users/udotelaar/gists{/gist_id}","starred_url":"https://api.github.com/users/udotelaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/udotelaar/subscriptions","organizations_url":"https://api.github.com/users/udotelaar/orgs","repos_url":"https://api.github.com/users/udotelaar/repos","events_url":"https://api.github.com/users/udotelaar/events{/privacy}","received_events_url":"https://api.github.com/users/udotelaar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-01-27T08:30:47Z","updated_at":"2018-06-14T19:12:47Z","closed_at":null,"author_association":"NONE","body":"If you try to deploy a project via git with a subdirectory that contains another subdirectory you run into this error:\r\n\r\nTASK [anistrano-deploy : ANSISTRANO | GIT | Sync repo subtree[\"\"] to release path] ***\r\nfatal: [server1]: FAILED! => {\"changed\": true, \"cmd\": \"{\\n git ls-files --with-tree=\\\"master\\\";\\n git submodule foreach --recursive --quiet 'git ls-files --with-tree=\\\"$sha1\\\" | sed \\\"s#^#$path/#\\\"';\\n } | grep \\\"^$prefix\\\" | sed \\\"s#^$prefix/##\\\" | rsync -a --files-from=- \\\"./$prefix/\\\" /var/www/server1/releases/20170127073653Z/\", \"delta\": \"0:00:00.137968\", \"end\": \"2017-01-27 07:37:20.570202\", \"failed\": true, \"rc\": 23, \"start\": \"2017-01-27 07:37:20.432234\", \"stderr\": \"rsync: link_stat \\\"/var/www/server/repo/deployment/ansible\\\" failed: No such file or directory (2)\\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]\", \"stdout\": \"\", \"stdout_lines\": [], \"warnings\": []}\r\n\r\nIn this case we have a \"Project\" with a subdirectory \"deployment\" and that contains another subdirectory \"ansible\"."},"comment":{"url":"https://api.github.com/repos/ansistrano/deploy/issues/comments/397407008","html_url":"https://github.com/ansistrano/deploy/issues/204#issuecomment-397407008","issue_url":"https://api.github.com/repos/ansistrano/deploy/issues/204","id":397407008,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzQwNzAwOA==","user":{"login":"lakiboy","id":1089265,"node_id":"MDQ6VXNlcjEwODkyNjU=","avatar_url":"https://avatars0.githubusercontent.com/u/1089265?v=4","gravatar_id":"","url":"https://api.github.com/users/lakiboy","html_url":"https://github.com/lakiboy","followers_url":"https://api.github.com/users/lakiboy/followers","following_url":"https://api.github.com/users/lakiboy/following{/other_user}","gists_url":"https://api.github.com/users/lakiboy/gists{/gist_id}","starred_url":"https://api.github.com/users/lakiboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakiboy/subscriptions","organizations_url":"https://api.github.com/users/lakiboy/orgs","repos_url":"https://api.github.com/users/lakiboy/repos","events_url":"https://api.github.com/users/lakiboy/events{/privacy}","received_events_url":"https://api.github.com/users/lakiboy/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T19:12:47Z","updated_at":"2018-06-14T19:12:47Z","author_association":"NONE","body":"To fix the above issue with nested submodule you can do the following:\r\n\r\nreplace this line in _tasks/update-code/git.yml_:\r\n\r\n```bash\r\ngit submodule foreach --recursive --quiet 'git ls-files -z --with-tree=\"$sha1\" | tr \"\\0\" \"\\n\" | sed \"s#^#$path/#\"'\r\n```\r\n\r\nwith this\r\n\r\n```bash\r\ngit submodule foreach --recursive | sed -n -e \"s/^Entering '\\(.*\\)'$/\\1/p\" | while read -r line; do (cd \"$line\"; git ls-files -z | tr \"\\0\" \"\\n\" | sed \"s#^#$line/#\"; cd $OLDPWD); done\r\n```\r\n\r\nThe latter uses the full path to the module. \r\n\r\nhth"}}
{"actor":{"display_login":"lakiboy"}}