testcontainers / testcontainers/testcontainers-java
RemoteDockerImage should fail immediately on fatal errors, ability to specify a custom pull retry timeout
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 9
説明
Right now RemoteDockerImage will try to re-pull container image on error until the default timeout of 2 minutes has been reached.
This is a reasonable thing to do to work around various I/O and network issues, but we should still allow user to specify a custom timeout and update the code to fail immediately on fatal errors (e.g. credential helper not available or invalid credentials configured).
Background, Context
If you utilize Docker image from some private registry (e.g. ECR, DockerHub, Quay, etc.) and credential helper for that registry is not available or credentials configured correctly, that could will try to retry up to 2 minutes before failing.
Exception similar to this one will be visible in the logs:
2021-02-23T12:34:35.050+0100 [DEBUG] [TestEventLogger] at java.base/java.lang.Thread.run(Thread.java:834)
2021-02-23T12:34:35.051+0100 [DEBUG] [TestEventLogger] [Test worker] WARN 🐳 [fooo.dkr.ecr.us-east-1.amazonaws.com/ingestion-pipeline:local-redis-cluster] - Retrying pull for image: foo.dkr.ecr.us-east-1.amazonaws.com/bar:foo (112s remaining)
2021-02-23T12:34:35.530+0100 [DEBUG] [TestEventLogger] [docker-java-stream--1357434991] ERROR com.github.dockerjava.api.async.ResultCallbackTemplate - Error during callback
2021-02-23T12:34:35.530+0100 [DEBUG] [TestEventLogger] com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"Get \"https://foo.dkr.ecr.us-east-1.amazonaws.com/v2/bar/foo\": no basic auth credentials"}
Proposed Change
I proposed updating that code to fail immediately if no basic auth credentials message is returned (https://github.com/Kami/testcontainers-java/blob/master/core/src/main/java/org/testcontainers/images/RemoteDockerImage.java#L87). I know that checking the error message is not the most robust thing, but it's probably the best we can do here.
Technically, Docker Java client could also be updated to throw some more specific exception in that case, but that would require more work.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
core/src/main/java/org/testcontainers/images/RemoteDockerImage.java から始め、特に参照されている 87 行目付近の retry ロジックを確認し、Docker pull エラーがどのように呼び出し元へ伝播するかを追跡してください。呼び出し元がカスタムの pull retry timeout を指定でき、また “no basic auth credentials” のような致命的な credential エラーがデフォルトの timeout を待たずに失敗すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, java
- 領域
- devops
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100