Skip to content

fix(fastapi-sqlalchemy-pg-catalog): retry the image's pip fetch and pin pydantic - #110

Draft
slayerjain wants to merge 1 commit into
add-fastapi-sqlalchemy-pg-catalogfrom
fix/pgcat-pip-fetch-rule
Draft

slayerjain wants to merge 1 commit into
add-fastapi-sqlalchemy-pg-catalogfrom
fix/pgcat-pip-fetch-rule

Conversation

@slayerjain

Copy link
Copy Markdown
Member

Stacked on #102 (the fastapi-sqlalchemy-pg-catalog sample); it only touches that sample's app image.

keploy/integrations' sqlalchemy-pg-catalog-postgres lane builds this image. On a CI runner whose uplink is saturated, pip gives up on an index page that stops moving for 15 s and reports the package as having no versions ("from versions: none"), which failed the integrations lanes that build pip images in pipelines 1910-1912 before keploy ran.

What changes:

  • The image's pip install follows the fetch rule the integrations lanes' own images use (keploy/integrations .ci/scripts/pip-fetch-rule_test.sh): at most 5 attempts, waiting attempt x 10 s between them, then exit 1 naming pip's last exit status. ARG PIP_RESUME_RETRIES=5 lets pip 25.1+ resume a cut download.
  • requirements.txt pins pydantic==2.14.1 (what the file resolves to today). fastapi takes pydantic 1 or 2, so a cut pydantic-core page made pip quietly install pydantic 1.10.26 instead of failing, and the lane tested a different app.

This is the only Dockerfile here that an integrations lane builds with pip: the doccano lane builds doccano-django/Dockerfile, which has no pip step.

Tested on an amd64 box, in the lane's own docker compose build app with keploy v3.6.161, through a PyPI index that sends half of one project's page on its first fetch and then stalls for 25 s:

  • fastapi's page cut: the previous image fails with "fastapi==0.115.0 (from versions: none)" and the lane fails; this one retries once after 10 s, builds, and the lane passes.
  • pydantic-core's page cut: the previous image builds with pydantic 1.10.26; this one fails attempt 1, retries, and builds with pydantic 2.14.1. The lane passes.
  • No cut: builds once, lane passes.

Once this merges, the integrations lane pins the resulting commit as its SAMPLES_SHA.

…ay keploy's CI lanes do

keploy/integrations' sqlalchemy-pg-catalog-postgres lane builds this
image. On a CI runner whose uplink a full pipeline saturates, pip gives
up on an index page that sends nothing for 15 s (its socket timeout),
logs why only at debug level, and reports the package as having no
versions:

  ERROR: Could not find a version that satisfies the requirement
  pydantic-core==... (from versions: none)

That failed the integrations lanes that build pip images in pipelines
1910, 1911 and 1912, before keploy ran.

The pip install now follows the fetch rule those lanes' own images use
(keploy/integrations .ci/scripts/pip-fetch-rule_test.sh, from
keploy/enterprise's .ci/scripts/fetch.sh), written inline because a
build context cannot reach a script: at most 5 attempts, waiting attempt
x 10 s between them and not after the last, then exit 1 naming pip's
last exit status. ARG PIP_RESUME_RETRIES=5 makes pip 25.1 and later
resume a cut download. A fetch is idempotent and fails because of the
network, so retrying it cannot hide a regression: a version that does
not exist fails all 5 attempts.

This is the only Dockerfile in this repo that an integrations lane
builds with pip: the doccano lane builds doccano-django/Dockerfile,
which has no pip step (its Dockerfile.coverage does, but no lane builds
it).

requirements.txt now pins pydantic (2.14.1, what the unpinned file
resolves to today). fastapi takes pydantic 1 or 2, so when pydantic-core's
index page was cut, pip did not fail: it resolved around the gap and
installed pydantic 1.10.26, and the lane went on to test a different app.
With the pin, that cut fails the install and the rule retries it.

On a box, in the lane's own `docker compose build app` (keploy/integrations
sqlalchemy-pg-catalog-postgres, keploy v3.6.161), with a PyPI index that
sends half of one project's page and then nothing for 25 s, on that
page's first fetch only:
- fastapi's page cut: the previous image fails with the CI error
  ("fastapi==0.115.0 (from versions: none)") and the lane fails; this one
  logs "pip install failed (attempt 1 of 5, exit 1), retrying in 10s",
  builds, and the lane passes.
- pydantic-core's page cut: the previous image builds with
  pydantic-1.10.26; this one fails attempt 1 on "pydantic-core==2.50.1
  (from pydantic) (from versions: none)", retries, and builds with
  pydantic-2.14.1. The lane passes both times.
- no cut: this one builds once and the lane passes.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
@slayerjain

Copy link
Copy Markdown
Member Author

This PR stacks on #102 (the fastapi-sqlalchemy-pg-catalog sample itself), so its base is #102's branch. Once #102 lands, this rebases onto main, and the integrations lane's SAMPLES_SHA pin moves to main's commit. Until then the lane pins this head (e307e7e).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant