ci: gen2並列デプロイの dockerRepository クラッシュを根本修正(AR事前作成+--docker-repository明示)#136
Merged
Merged
Conversation
Go関数(gen2)の並列デプロイで一部が gcloud crashed (AttributeError): 'NoneType' object has no attribute 'dockerRepository' で非決定的に失敗していた(並列時のみ・ランダムな一部・前回は偶然全成功)。 原因はgcloudがイメージ格納先のArtifact Registryリポジトリ(gcf-artifacts)を 遅延自動解決する際、並列実行で解決が競合しNoneになること。 対策(根本): gcf-artifactsリポジトリを事前作成し、各deployに --docker-repositoryを明示指定して自動解決の競合そのものを除去する。 dev/prod両方に適用。 Co-authored-by: kojira <kojira@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
症状
env/devの dev-deploy 実行(ac3d323)で「deploy all Go Cloud Run functions in parallel」が失敗。10本中2本(userOGPGo/scheduledOgpDeleteGo)が同一クラッシュ:直前の同一 workflow 実行(
52de97b)では全10本成功しており、並列時のみ・ランダムな一部・非決定的という挙動だった。根本原因
gen2(Cloud Run)関数のデプロイは、イメージ格納先の Artifact Registry docker リポジトリ(デフォルト
gcf-artifacts)を gcloud が遅延自動解決 する。複数のgcloud functions deployを並列実行すると、この解決処理が競合してリポジトリ参照がNoneになり、dockerRepository属性アクセスでクラッシュする。GCP公式ドキュメント/SO でも AR リポジトリの事前用意と--docker-repository明示が推奨されている。対策(根本対応・フォールバックではない)
gcf-artifacts(us-central1, docker) を 事前に冪等作成 するステップを追加。gcloud functions deployに--docker-repository=projects/<project>/locations/us-central1/repositories/gcf-artifactsを 明示指定し、自動解決の競合源そのものを除去。dev-deploy.yml(project=d-shrine-dev) /prod-deploy.yml(project=d-shrine) 両方に適用。リトライ等の見かけ上の回避は入れていない。検証
actionlint両ファイルパス。main → env/dev反映で dev-deploy が再実行され、10本全て成功することを実地確認する。