-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Synapse's docker images (and CI?) do not pin the specific build requirements of poetry #13849
Comments
I can reproduce this with |
Regressed in #12385 according to a bisection |
I think the version requirement comes from https://github.com/python-poetry/poetry/blob/fb13b3a676f476177f7937ffa480ee5cff9a90a5/pyproject.toml#L54 in the specific version of poetry we use in that version of the lockfile. But what I don't understand is why this is suddenly a problem now, given that we built the images just fine at the time. |
Seems to be python-poetry/poetry-core#461. Related:
Frustrating. Goes to show that we should have properly somehow frozen the environment for poetry itself (C.f. #12853). I hate Python packaging. I suspect the easiest way to fix this will be to try to rebuild from v1.61 with a patched dockerfile. Let me get back to you on that. |
Running
in a clean virtualenv includes this line:
which I think comes from here. This pulls in poetry-core 1.2.0 to try and build the pinned version of poetry itself... but this is now broken as python-poetry/poetry#6376 noted. We were using an unreleased poetry version so maybe this serves us right. But it's still incredibly frustrating. |
Given that we have no control over what version diff --git a/docker/Dockerfile b/docker/Dockerfile
index 7af0e51f9..29010b436 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -55,7 +55,7 @@ RUN \
# NB: In poetry 1.2 `poetry export` will be moved into a plugin; we'll need to also
# pip install poetry-plugin-export (https://github.com/python-poetry/poetry-plugin-export).
RUN --mount=type=cache,target=/root/.cache/pip \
- pip install --user "poetry-core==1.1.0a7" "git+https://github.com/python-poetry/poetry.git@fb13b3a676f476177f7937ffa480ee5cff9a90a5"
+ pip install --user "poetry-core==1.2.0" "poetry==1.2.1"
WORKDIR /synapse
This doesn't create a bitwise identical container, but I think it's the best we can do.
```
$ container-diff diff -t apt -t pip -t sizelayer -t metadata -t history matrixdotorg/synapse:v1.61.0 daemon://fred:latest
ERRO[0011] failed to locate python package for corresponding package metadata matrix-synapse
ERRO[0011] failed to locate python package for corresponding package metadata matrix-synapse
-----Apt----- Packages found only in matrixdotorg/synapse:v1.61.0: None Packages found only in fred:latest: None Version differences: -----History----- Docker history lines found only in matrixdotorg/synapse:v1.61.0: Docker history lines found only in fred:latest: -----Metadata----- Image metadata differences between matrixdotorg/synapse:v1.61.0 and fred:latest: matrixdotorg/synapse:v1.61.0 fred:latest -----Pip----- Packages found only in matrixdotorg/synapse:v1.61.0: None Packages found only in fred:latest: None Version differences: -----SizeLayer----- Layer size differences between matrixdotorg/synapse:v1.61.0 and fred:latest:
|
If we wanted to pin this for the future, we could manually do e.g. |
Agreed. I was worried about managing poetry's dependencies itself during #11537 but clearly dropped the ball on this one. :( However: I'm not sure if |
Is this issue still up to date? |
It is still the case that the dockerfile does not pin poetry's dependencies, yes: Lines 60 to 61 in d4eba44
|
@DMRobertson could you update the issue summary, then? Currently it reads as if there is a specific problem with v1.61, which seems like a difficult thing to care about. |
I have updated the description; I hope it is comprehensible. However on reflection I think we should probably ignore (close?) this:
Let's discuss among the team. |
Closing as WONTFIX. |
Synapse's docker file installs a specific version of poetry in build stage 0:
synapse/docker/Dockerfile
Lines 58 to 61 in 08297f2
and uses it to export a requirements.txt file for the other stages to use (without having to install poetry).
synapse/docker/Dockerfile
Lines 78 to 85 in 08297f2
The former step is not fully reproducible1, because
pip
will use the latest version of poetry's build-time dependencies to install poetry. (As of poetry 1.3.2 those dependencies are the unbounded rangepoetry-core >= 1.1.0
, see here). I advised the reporter to patch the Dockerfile in order to get Synapse 1.61 built again.We saw this manifest in the report below: a version of poetry-core was released under which previous versions of poetry would fail to build, see #13849 (comment).
It seems like the Python packaging ecosystem doesn't have an obvious way to pin build-time dependencies. (See for instance https://discuss.python.org/t/pinning-build-dependencies/8363 or pypa/pip#9542.) The best approach that I can see is described in pypa/pip#9542 (comment), namely
pip install --no-build-isolation ...
Original issue:
Unable to build v1.61.0 docker image with clean caches
Just tried to build v1.61.0 on Linux and Windows and both fail.
I know this worked a few weeks ago and I basically think that OP was right with the version pining.
Motivation: I want to bisect and thus build v1.61.0 .. v1.62.0 for identifying a patch which destroyed the generate call for us (I'll open a new ticket for that one).
Here is the error:
Originally posted by @qknight in #11537 (comment)
Footnotes
The steps which run
apt-get update
and run the abitrarysh.rustup.sh
script aren't reproducible either, if anyone's counting. ↩The text was updated successfully, but these errors were encountered: