Repository navigation
fix(ci): compose 恢复演练等数据库可连接后再 pg_restore - #54
Merged
Merged
Conversation
pg_isready 在 entrypoint 的临时实例阶段就会返回成功,此时 POSTGRES_DB 还没 创建,pg_restore 会因 database does not exist 失败。改为用 psql 探测目标库。
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.
master 的 quality 在
pnpm compose:smoke上偶发失败:原因:恢复用的容器用
pg_isready -d devtodo等就绪,但pg_isready只检查服务是否接受连接。postgres 镜像的 entrypoint 会先起一个临时实例做初始化,这个阶段就已经能接受连接,而POSTGRES_DB还没创建,于是pg_restore撞上不存在的库。改成对目标库执行
psql -c 'select 1':库不存在或临时实例阶段都返回非零,只有真正的实例建好库之后才通过。同一个 PR run 里它通过、master run 里失败,说明是竞态而不是回归。