posit-dev / posit-dev/rsconnect-python

GitHub Action fails due to Docker Compose Call Sequence

オープン
#448 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
37
フォーク
28
平均マージ
1日 3時間
マージ済み PR(30日)
7

説明

Summary

The CI GitHub Action occasionally fails when executing the following step: https://github.com/rstudio/rsconnect-python/blob/master/.github/workflows/main.yml#L156-L182

See https://github.com/rstudio/rsconnect-python/actions/runs/5478386182/jobs/9999333833

In some instances, this results in the following error:

docker-compose up -d
rsconnect-python_rsconnect_1 is up-to-date
docker-compose exec -T rsconnect bash < vetiver-testing/setup-rsconnect/add-users.sh
Error response from daemon: Container 9bdc42da9e0c00adaa7765fde5cb31926403c905f2cd590f640bcc427092031e is restarting, wait until the container is running
make: *** [Makefile:173: dev] Error 1
Error: Process completed with exit code 2.

Reasoning

During the execution of the make dev target, two consecutive commands to docker-compose are issued here: https://github.com/rstudio/rsconnect-python/blob/master/.github/workflows/main.yml#L156-L182

The second command, docker-compose exec, causes an asynchronous container restart. This is not mentioned in the documentation and no logs are produced. But the restart can be viewed by watching docker ps during the execution of make dev.

Due to the asynchronous nature of the issued restart on "fast" machines, the shell script vetiver-testing/setup-rsconnect/add-users.sh will execute before the restart is complete. In some instances, this is not observed since the initialization sequence is observed before the shell script executes.

When this occurs, the shell script will log errors related to the cracklib-runtime. This is due to the cracklib-runtime not having finished initializing before the chpasswd command being issued.

RCA

On my local machine, I can recreate this issue using the following steps:

  1. Open a terminal window and run while true; do docker ps; echo; done | while IFS= read -r line; do printf '[%s] %s\n' "$(date '+%H:%M:%S')" "$line"; done > log.
  2. Execute make dev
  3. After make dev completes. Stop the first command.
  4. Inspect the log file and search for "Less than a second ago".

Note that lines containing this message are issued in two distinct blocks. The first block is the initial startup via docker-compose up -d. The second block comes from docker-compose exec ....

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

.github/workflows/main.yml の 156-182 行目、Makefile の make dev ターゲット、vetiver-testing/setup-rsconnect/add-users.sh から始めます。説明されているとおり docker ps を監視しながら make dev を実行し、その後、リンクされた Actions の実行と記録されたログを確認します。CI ステップがコンテナの再起動と競合しなくなり、cracklib-runtime 関連のエラーが発生しなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker-compose, github-actions, python
領域
ci-cd, devops
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。