如果使用分支,则Capistrano 3.6.1不会部署最新版本。我将dev
分支部署在Githab上,将dev
分支设置为默认分支。
config/deploy/staging.rb
set :branch, 'dev'
我在本地提交了dev
分支,将其推送到远程的dev
,我可以在Gitlab的远程dev
分支上看到这些提交,但是Capistrano并没有将它们提交。每次部署时,它都会设置旧版本的镜像克隆。我将dev
分支与master
进行了比较,并且master
完全不同,它不包含部署后我认为设置为current
的修订。
GIT 本地机器
git --version
git version 2.22.0
服务器
git --version
git version 2.1.4
Capistrano 3.6.1
我发现了类似的问题https://github.com/capistrano/capistrano/issues/1773
它从未修复过,仅提出了一种解决方法-删除repo
文件夹,该文件夹对我不起作用。其他线程中的Stackoverflow答案也建议删除repo
文件夹,但这对我来说不起作用,因此到目前为止,我还没有找到任何解决方案。
完整的堆栈跟踪: https://gist.github.com/jedrekdomanski/de540411a7fe02257fd4f225ab6f7165
cap staging deploy --trace
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO [94b69fa0] Running /usr/bin/env mkdir -p /tmp as apps@195.128.228.103
DEBUG [94b69fa0] Command: /usr/bin/env mkdir -p /tmp
INFO [94b69fa0] Finished in 0.224 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/git-ssh-lauber-frontend-staging-jedrek.sh 0.0%
INFO Uploading /tmp/git-ssh-lauber-frontend-staging-jedrek.sh 100.0%
INFO [07964889] Running /usr/bin/env chmod 700 /tmp/git-ssh-lauber-frontend-staging-jedrek.sh as apps@195.128.228.103
DEBUG [07964889] Command: /usr/bin/env chmod 700 /tmp/git-ssh-lauber-frontend-staging-jedrek.sh
INFO [07964889] Finished in 0.029 seconds with exit status 0 (successful).
** Execute git:check
INFO [564c96e3] Running /usr/bin/env git ls-remote --heads git@gitlab.ideamotiv.com:lauber/lauber-frontend.git as apps@195.128.228.103
DEBUG [564c96e3] Command: ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-lauber-frontend-staging-jedrek.sh" ; /usr/bin/env git ls-remote --heads git@gitlab.ideamotiv.com:lauber/lauber-frontend.git )
DEBUG [564c96e3] c30af359a8e0fa0494d842005d29cee8ab685ba6 refs/heads/LK-743-Headers-optimizations
b8b65e312245e409c11d40d5fc791f501f137505 refs/heads/LK-744-Add-meta-tags-and-meta-descriptions
a78d7aa366d944d24bccbe26a3563fbab0fbde53 refs/heads/LK-746-Friendly-urls
3cf9da5b998b22e45fb0bb409aeea3d91f4e4e42 refs/heads/LK-748-Images-alt-descriptions
23953e6d2a0bb7f8e71f73a9cbab0f92d2a32ba3 refs/heads/LK-750-Rich-snippets
be8ae00a1ae6da190effa3144d314039ed728077 refs/heads/LK-757-Add-subdomains-for-languages
3503c45fbf2475a7ae5cdb34227fd4e187fff031 refs/heads/LK-761-List-page-for-categories
17549a551c28f1fdd9b6688633af2b0ae327e3b9 refs/heads/LK-763-Title-and-short-description-for-part-page
67357f094433021d13577b4d84c038998064cb63 refs/heads/catalog
d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93 refs/heads/dev
39f90d30754c32bd422c00df8139a8a369398864 refs/heads/master
8e12f9b452e7ba41c432554c68302a035e62a97a refs/heads/properties
8ce29ee1dfe13828188e5d5b0275e211dc9f4032 refs/heads/shop
5becebcddb8d39ffcdc84a3b33af2c3a47e23db1 refs/heads/test-deploy-branch
ae3ea93e749c99d4d2e17986b6afe35b23c5b5b3 refs/heads/vehicles
INFO [564c96e3] Finished in 1.090 seconds with exit status 0 (successful).
** Invoke deploy:check:directories (first_time)
** Execute deploy:check:directories
INFO [74bfa000] Running /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/shared /home/apps/app/shop-lauber-frontend/production/releases as apps@195.128.228.103
DEBUG [74bfa000] Command: /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/shared /home/apps/app/shop-lauber-frontend/production/releases
INFO [74bfa000] Finished in 0.033 seconds with exit status 0 (successful).
** Invoke deploy:check:linked_dirs (first_time)
** Execute deploy:check:linked_dirs
INFO [0e7b5cbb] Running /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/shared/app/translations as apps@195.128.228.103
DEBUG [0e7b5cbb] Command: /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/shared/app/translations
INFO [0e7b5cbb] Finished in 0.031 seconds with exit status 0 (successful).
** Invoke deploy:check:make_linked_dirs (first_time)
** Execute deploy:check:make_linked_dirs
INFO [42e2f0c1] Running /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/shared as apps@195.128.228.103
DEBUG [42e2f0c1] Command: /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/shared
INFO [42e2f0c1] Finished in 0.030 seconds with exit status 0 (successful).
** Invoke deploy:check:linked_files (first_time)
** Execute deploy:check:linked_files
DEBUG [1385d44d] Running [ -f /home/apps/app/shop-lauber-frontend/production/shared/.env ] as apps@195.128.228.103
DEBUG [1385d44d] Command: [ -f /home/apps/app/shop-lauber-frontend/production/shared/.env ]
DEBUG [1385d44d] Finished in 0.031 seconds with exit status 0 (successful).
** Invoke deploy:set_previous_revision (first_time)
** Execute deploy:set_previous_revision
DEBUG [e5f3d36e] Running [ -f /home/apps/app/shop-lauber-frontend/production/current/REVISION ] as apps@195.128.228.103
DEBUG [e5f3d36e] Command: [ -f /home/apps/app/shop-lauber-frontend/production/current/REVISION ]
DEBUG [e5f3d36e] Finished in 0.032 seconds with exit status 0 (successful).
DEBUG [e5ce6be7] Running /usr/bin/env cat /home/apps/app/shop-lauber-frontend/production/current/REVISION 2>/dev/null as apps@195.128.228.103
DEBUG [e5ce6be7] Command: /usr/bin/env cat /home/apps/app/shop-lauber-frontend/production/current/REVISION 2>/dev/null
DEBUG [e5ce6be7] d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93
DEBUG [e5ce6be7] Finished in 0.026 seconds with exit status 0 (successful).
** Invoke deploy:started (first_time)
** Execute deploy:started
** Invoke deploy:updating (first_time)
** Invoke deploy:new_release_path (first_time)
** Execute deploy:new_release_path
** Execute deploy:updating
** Invoke git:create_release (first_time)
** Invoke git:update (first_time)
** Invoke git:clone (first_time)
** Invoke git:wrapper
** Execute git:clone
DEBUG [bbadb24c] Running [ -f /home/apps/app/shop-lauber-frontend/production/repo/HEAD ] as apps@195.128.228.103
DEBUG [bbadb24c] Command: [ -f /home/apps/app/shop-lauber-frontend/production/repo/HEAD ]
DEBUG [bbadb24c] Finished in 0.025 seconds with exit status 0 (successful).
INFO The repository mirror is at /home/apps/app/shop-lauber-frontend/production/repo
** Execute git:update
DEBUG [b156b58d] Running if test ! -d /home/apps/app/shop-lauber-frontend/production/repo; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/repo'" 1>&2; false; fi as apps@195.128.228.103
DEBUG [b156b58d] Command: if test ! -d /home/apps/app/shop-lauber-frontend/production/repo; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/repo'" 1>&2; false; fi
DEBUG [b156b58d] Finished in 0.029 seconds with exit status 0 (successful).
INFO [2fa00ea8] Running /usr/bin/env git remote update --prune as apps@195.128.228.103
DEBUG [2fa00ea8] Command: cd /home/apps/app/shop-lauber-frontend/production/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-lauber-frontend-staging-jedrek.sh" ; /usr/bin/env git remote update --prune )
DEBUG [2fa00ea8] Fetching origin
INFO [2fa00ea8] Finished in 0.887 seconds with exit status 0 (successful).
** Execute git:create_release
DEBUG [8ed09795] Running if test ! -d /home/apps/app/shop-lauber-frontend/production/repo; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/repo'" 1>&2; false; fi as apps@195.128.228.103
DEBUG [8ed09795] Command: if test ! -d /home/apps/app/shop-lauber-frontend/production/repo; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/repo'" 1>&2; false; fi
DEBUG [8ed09795] Finished in 0.024 seconds with exit status 0 (successful).
INFO [d7be5387] Running /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 as apps@195.128.228.103
DEBUG [d7be5387] Command: cd /home/apps/app/shop-lauber-frontend/production/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-lauber-frontend-staging-jedrek.sh" ; /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 )
INFO [d7be5387] Finished in 0.034 seconds with exit status 0 (successful).
INFO [b4c34014] Running /usr/bin/env git archive dev | tar -x -f - -C /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 as apps@195.128.228.103
DEBUG [b4c34014] Command: cd /home/apps/app/shop-lauber-frontend/production/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-lauber-frontend-staging-jedrek.sh" ; /usr/bin/env git archive dev | tar -x -f - -C /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 )
INFO [b4c34014] Finished in 0.079 seconds with exit status 0 (successful).
** Invoke deploy:set_current_revision (first_time)
** Execute deploy:set_current_revision
** Invoke git:set_current_revision (first_time)
** Execute git:set_current_revision
DEBUG [b10c1d3f] Running if test ! -d /home/apps/app/shop-lauber-frontend/production/repo; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/repo'" 1>&2; false; fi as apps@195.128.228.103
DEBUG [b10c1d3f] Command: if test ! -d /home/apps/app/shop-lauber-frontend/production/repo; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/repo'" 1>&2; false; fi
DEBUG [b10c1d3f] Finished in 0.029 seconds with exit status 0 (successful).
DEBUG [e21a9758] Running /usr/bin/env git rev-list --max-count=1 dev as apps@195.128.228.103
DEBUG [e21a9758] Command: cd /home/apps/app/shop-lauber-frontend/production/repo && ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-lauber-frontend-staging-jedrek.sh" ; /usr/bin/env git rev-list --max-count=1 dev )
DEBUG [e21a9758] d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93
DEBUG [e21a9758] Finished in 0.032 seconds with exit status 0 (successful).
DEBUG [159ee256] Running if test ! -d /home/apps/app/shop-lauber-frontend/production/releases/20190712200021; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/releases/20190712200021'" 1>&2; false; fi as apps@195.128.228.103
DEBUG [159ee256] Command: if test ! -d /home/apps/app/shop-lauber-frontend/production/releases/20190712200021; then echo "Directory does not exist '/home/apps/app/shop-lauber-frontend/production/releases/20190712200021'" 1>&2; false; fi
DEBUG [159ee256] Finished in 0.030 seconds with exit status 0 (successful).
INFO [189a4cd6] Running /usr/bin/env echo "d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93" >> REVISION as apps@195.128.228.103
DEBUG [189a4cd6] Command: cd /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 && /usr/bin/env echo "d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93" >> REVISION
INFO [189a4cd6] Finished in 0.026 seconds with exit status 0 (successful).
** Invoke deploy:symlink:shared (first_time)
** Execute deploy:symlink:shared
** Invoke deploy:symlink:linked_files (first_time)
** Execute deploy:symlink:linked_files
INFO [2913d95e] Running /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 as apps@195.128.228.103
DEBUG [2913d95e] Command: /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/releases/20190712200021
INFO [2913d95e] Finished in 0.029 seconds with exit status 0 (successful).
DEBUG [f906c2bd] Running [ -L /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/.env ] as apps@195.128.228.103
DEBUG [f906c2bd] Command: [ -L /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/.env ]
DEBUG [f906c2bd] Finished in 0.038 seconds with exit status 1 (failed).
DEBUG [b18fce9c] Running [ -f /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/.env ] as apps@195.128.228.103
DEBUG [b18fce9c] Command: [ -f /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/.env ]
DEBUG [b18fce9c] Finished in 0.031 seconds with exit status 1 (failed).
INFO [c7602359] Running /usr/bin/env ln -s /home/apps/app/shop-lauber-frontend/production/shared/.env /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/.env as apps@195.128.228.103
DEBUG [c7602359] Command: /usr/bin/env ln -s /home/apps/app/shop-lauber-frontend/production/shared/.env /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/.env
INFO [c7602359] Finished in 0.026 seconds with exit status 0 (successful).
** Invoke deploy:symlink:linked_dirs (first_time)
** Execute deploy:symlink:linked_dirs
INFO [4bbf4fc8] Running /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app as apps@195.128.228.103
DEBUG [4bbf4fc8] Command: /usr/bin/env mkdir -p /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app
INFO [4bbf4fc8] Finished in 0.026 seconds with exit status 0 (successful).
DEBUG [d8b883a0] Running [ -L /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations ] as apps@195.128.228.103
DEBUG [d8b883a0] Command: [ -L /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations ]
DEBUG [d8b883a0] Finished in 0.030 seconds with exit status 1 (failed).
DEBUG [b7dfd293] Running [ -d /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations ] as apps@195.128.228.103
DEBUG [b7dfd293] Command: [ -d /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations ]
DEBUG [b7dfd293] Finished in 0.032 seconds with exit status 0 (successful).
INFO [9960c6d6] Running /usr/bin/env rm -rf /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations as apps@195.128.228.103
DEBUG [9960c6d6] Command: /usr/bin/env rm -rf /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations
INFO [9960c6d6] Finished in 0.032 seconds with exit status 0 (successful).
INFO [e75dc524] Running /usr/bin/env ln -s /home/apps/app/shop-lauber-frontend/production/shared/app/translations /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations as apps@195.128.228.103
DEBUG [e75dc524] Command: /usr/bin/env ln -s /home/apps/app/shop-lauber-frontend/production/shared/app/translations /home/apps/app/shop-lauber-frontend/production/releases/20190712200021/app/translations
INFO [e75dc524] Finished in 0.032 seconds with exit status 0 (successful).
** Invoke deploy:updated (first_time)
** Execute deploy:updated
** Invoke deploy:publishing (first_time)
** Execute deploy:publishing
** Invoke deploy:symlink:release (first_time)
** Execute deploy:symlink:release
INFO [56ca3dec] Running /usr/bin/env ln -s /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 /home/apps/app/shop-lauber-frontend/production/releases/current as apps@195.128.228.103
DEBUG [56ca3dec] Command: /usr/bin/env ln -s /home/apps/app/shop-lauber-frontend/production/releases/20190712200021 /home/apps/app/shop-lauber-frontend/production/releases/current
INFO [56ca3dec] Finished in 0.031 seconds with exit status 0 (successful).
INFO [f5ae2076] Running /usr/bin/env mv /home/apps/app/shop-lauber-frontend/production/releases/current /home/apps/app/shop-lauber-frontend/production as apps@195.128.228.103
DEBUG [f5ae2076] Command: /usr/bin/env mv /home/apps/app/shop-lauber-frontend/production/releases/current /home/apps/app/shop-lauber-frontend/production
INFO [f5ae2076] Finished in 0.033 seconds with exit status 0 (successful).
** Invoke deploy:published (first_time)
** Execute deploy:published
** Invoke deploy:finishing (first_time)
** Execute deploy:finishing
** Invoke deploy:cleanup (first_time)
** Invoke npm:build (first_time)
** Execute npm:build
INFO [afd2116b] Running cd /home/apps/app/shop-lauber-frontend/production/current && npm install && npm run build as apps@195.128.228.103
DEBUG [afd2116b] Command: cd /home/apps/app/shop-lauber-frontend/production/current && npm install && npm run build
DEBUG [afd2116b]
服务器上的 dev
分支
apps@hoth:~/app/shop-lauber-frontend/production/current$ cat REVISION
d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93
本地dev
分支
commit 18335e66a1d8a2d18649b320f7220e67f93f6d3c (HEAD -> dev, origin/dev, origin/HEAD)
Date: Fri Jul 12 11:53:02 2019 +0200
Test commit
commit f153ce5c836ff4f5fa088499bfe4b477b4bee10b (Update-part-substitution-header, Update-part-page-title)
Date: Tue Jul 9 10:43:43 2019 +0200
Update part page title
commit 39f94d47e8426a33eb8ef53b15d8ab79cebb2343 (Update-parts-image-alt-and-meta-tags)
Date: Tue Jul 9 10:07:26 2019 +0200
Update parts image alt and meta tags
commit d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93
Merge: da5c334 3503c45
See merge request lauber/lauber-frontend!24
所以最后3次提交在服务器上的git repo中不可用,但在本地和远程repo(Gitlab)中都可用
apps@hoth:~/app/shop-lauber-frontend/production$ cat revisions.log
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190515113248 by sylwiaszymanska
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190710102344 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190710104326 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190710110701 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190710135109 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190710140939 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190710164118 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190710171703 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190712094210 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190712095436 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190712145228 by jedrek
Branch dev (at d4171ad2b8d8cbdde3dc858a7bb1f0eb2233ee93) deployed as release 20190712160325 by jedrek
它部署了旧版本。
第69行正在检查先前的修订。
第91行是否正在更新git remote update --prune
而没有先前从回购中提取最新提交?
第113行将旧版本设置为当前版本。
在上一次尝试中,在获取原始数据之前,它做了git clone --mirror git@XXXX/lauber-frontend.git repo
,但是这次我不再看到它了。我不确定为什么要进行镜像克隆,但无论如何它都没有拉最新的更改。
答案 0 :(得分:0)
我从Capistrano开发团队得到了帮助,该团队向我指出了我的capistrano配置中的不同存储库URL。我完全想念它。在我接管项目后,回购网址似乎已更改,但我没有意识到。我更新了repo_url,还必须删除服务器上的repo
文件夹,这解决了我的问题。