Wait for docker pull in CI (#2023)

CI can fail if `docker pull ...` takes longer than expected. This PR
adds a `--pull-only` option to `./start`, then waits for it to complete
in CI.
This commit is contained in:
Frank Harkins 2024-09-24 16:17:29 +01:00 committed by GitHub
parent 509840c37b
commit a43cab8375
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -51,11 +51,14 @@ jobs:
with: with:
files: docs/**/*.{md,mdx,ipynb} files: docs/**/*.{md,mdx,ipynb}
separator: "\n" separator: "\n"
- name: Pull preview image
if: steps.changed-docs-files.outputs.any_changed == 'true'
run: ./start --pull-only
- name: Start local Docker preview - name: Start local Docker preview
if: steps.changed-docs-files.outputs.any_changed == 'true' if: steps.changed-docs-files.outputs.any_changed == 'true'
run: | run: |
./start --apis & ./start --apis &
sleep 20 sleep 1
- name: Check that pages render - name: Check that pages render
if: steps.changed-docs-files.outputs.any_changed == 'true' if: steps.changed-docs-files.outputs.any_changed == 'true'
run: | run: |

4
start
View File

@ -27,6 +27,10 @@ def skip_apis() -> tuple[str]:
return ("-v", "/home/node/app/docs/api") return ("-v", "/home/node/app/docs/api")
def main() -> None: def main() -> None:
if "--pull-only" in sys.argv:
subprocess.run(["docker", "pull", IMAGE], check=True)
sys.exit(0)
print( print(
"Warning: this may be using an outdated version of the app. Run " "Warning: this may be using an outdated version of the app. Run "
+ f"`docker pull {IMAGE}` to check for updates.", + f"`docker pull {IMAGE}` to check for updates.",