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

Fix deployment inconsistencies #427

Merged
merged 2 commits into from
Jun 7, 2024
Merged

Conversation

naomichi-y
Copy link
Member

@naomichi-y naomichi-y commented May 23, 2024

デプロイ時に更新したはずのブランチが適用されず、genova再起動で解消するケースがありました。
特定の環境で短期間に2度発生していることから、5.0.1で更新したgitのGem更新が関連している可能性があります。
また、Dir.chdir におけるスレッドセーフ問題が修正が取り込まれた 1.19 ではなく 1.18 をインストールしていたので、合わせて修正となります。

以下はデプロイ時のログです。

# metaps/xxxリポジトリでGit open
{"log":"I, [2024-05-23T10:54:06.190378 #7]  INFO -- : Git open: /app/tmp/repos/metaps/xxx\n","stream":"stdout","time":"2024-05-23T10:54:06.190599189Z"}
{"log":"I, [2024-05-23T10:54:06.208553 #7]  INFO -- : Starting Git\n","stream":"stdout","time":"2024-05-23T10:54:06.209035314Z"}
{"log":"I, [2024-05-23T10:54:06.208690 #7]  INFO -- : Git checkout: feature/fix_yyy\n","stream":"stdout","time":"2024-05-23T10:54:06.209069229Z"}

# この時点でwork-treeがxxx-backendに置き換わっている (前後で並行してデプロイが走っていないことは確認済み)
{"log":"I, [2024-05-23T10:54:08.874138 #7]  INFO -- : git '--git-dir=/app/tmp/repos/metaps/xxx-backend/.git' '--work-tree=/app/tmp/repos/metaps/xxx-backend' '-c' 'core.quotePath=true' '-c' 'color.ui=false' 'fetch' '--prune'  2\u003e\u00261\n","stream":"stdout","time":"2024-05-23T10:54:08.874343801Z"}
{"log":"I, [2024-05-23T10:54:08.893103 #7]  INFO -- : git '--git-dir=/app/tmp/repos/metaps/xxx-backend/.git' '--work-tree=/app/tmp/repos/metaps/xxx-backend' '-c' 'core.quotePath=true' '-c' 'color.ui=false' 'clean' '--force' '-d'  2\u003e\u00261\n","stream":"stdout","time":"2024-05-23T10:54:08.893288404Z"}
{"log":"I, [2024-05-23T10:54:08.907617 #7]  INFO -- : git '--git-dir=/app/tmp/repos/metaps/xxx-backend/.git' '--work-tree=/app/tmp/repos/metaps/xxx-backend' '-c' 'core.quotePath=true' '-c' 'color.ui=false' 'checkout' 'feature/fix_yyy'  2\u003e\u00261\n","stream":"stdout","time":"2024-05-23T10:54:08.90777503Z"}
{"log":"I, [2024-05-23T10:54:08.908836 #7]  INFO -- : {\"channel\":\"GE4N6LFPS\",\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\"Oops! Runtime error has occurred.\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Error:*\\nGit::FailedError\\n*Reason:*\\n```git '--git-dir=/app/tmp/repos/metaps/xxx-backend/.git' '--work-tree=/app/tmp/repos/metaps/xxx-backend' '-c' 'core.quotePath=true' '-c' 'color.ui=false' 'checkout' 'feature/fix_yyy'  2\\u003e\\u00261\\nstatus: pid 5844 exit 1\\noutput: \\\"error: pathspec 'feature/fix_yyy' did not match any file(s) known to git\\\\n\\\"```\\n*Backtrace:*\\n```/usr/local/bundle/gems/git-1.18.0/lib/git/lib.rb:1216:in `command'\\n/usr/local/bundle/gems/git-1.18.0/lib/git/lib.rb:834:in `checkout'\\n/usr/local/bundle/gems/git-1.18.0/lib/git/base.rb:359:in `checkout'\\n/app/lib/autoloads/genova/code_manager/git.rb:42:in `update'\\n/app/app/workers/github/deploy_worker.rb:44:in `find'\\n/app/app/workers/github/deploy_worker.rb:12:in `perform'\\n/usr/local/bundle/gems/sidekiq-7.1.3/lib/sidekiq/processor.rb:210:in `execute_job'\\n/usr/local/bundle/gems/sidekiq-7.1.3/lib/sidekiq/pro...```\\n\"}}],\"thread_ts\":null}\n","stream":"stdout","time":"2024-05-23T10:54:08.908974561Z"}

https://github.com/metaps/genova/blob/develop/lib/autoloads/genova/code_manager/git.rb#L28-L42

@@ -103,7 +103,7 @@ def find_commit(tag)
git = client
git.fetch(prune: true)
git.tag(tag).sha
rescue ::Git::GitTagNameDoesNotExist
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naomichi-y naomichi-y requested a review from h-nago May 29, 2024 15:49
@naomichi-y naomichi-y merged commit 4e72b5c into develop Jun 7, 2024
@naomichi-y naomichi-y changed the title Update git to 2.0.1 Fix deployment inconsistencies Jun 7, 2024
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

Successfully merging this pull request may close these issues.

2 participants