Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for testing on Python 3.10 #1184

Merged
merged 26 commits into from
Feb 10, 2022
Merged

Add support for testing on Python 3.10 #1184

merged 26 commits into from
Feb 10, 2022

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented Jan 25, 2022

As the title states. One of the tasks outlined here: matrix-org/synapse#11780. Builds a new Docker image with debian:bookworm as the base, pushes it to DockerHub and adds the new image to CI for testing.

@H-Shay H-Shay requested a review from a team as a code owner January 25, 2022 21:39
Copy link
Contributor

@DMRobertson DMRobertson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://packages.debian.org/bookworm/python3 seems to suggest that bookworm includes Python 3.9 by default. We'd have to explicitly opt-in to using 3.10 I think, by apt-installing this.

Does that sound right @richvdh ?

@richvdh
Copy link
Member

richvdh commented Jan 26, 2022

Yup, looks that way. Not only that, we need to use it explicitly:

rav@fred:~$ docker run --rm -it debian:bookworm
root@294ab397ee09:/# apt update -qq
1 package can be upgraded. Run 'apt list --upgradable' to see it.
root@294ab397ee09:/# apt install -y python3
...
root@294ab397ee09:/# python3 --version
Python 3.9.10

root@294ab397ee09:/# apt install -y python3.10
...
root@294ab397ee09:/# python3 --version
Python 3.9.10
root@294ab397ee09:/# python3.10 --version
Python 3.10.2

... so I think we need to change synapse.Dockerfile to use python3.10 explicitly, as well as installing the right package.

Not sure if this is best done via docker build args (https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) or with a completely separate dockerfile.

@H-Shay
Copy link
Contributor Author

H-Shay commented Jan 27, 2022

I took a stab at using a separate dockerfile for building the 3.10 image and using it explicitly. I am none too familiar with docker but I think I succeeded, very open to feedback if I am wrong or there's a more elegant way to do this!

@DMRobertson DMRobertson requested a review from a team January 27, 2022 12:57
@DMRobertson DMRobertson dismissed their stale review January 27, 2022 12:59

fixed, needs a re-review

.github/workflows/docker.yml Outdated Show resolved Hide resolved
.github/workflows/docker.yml Outdated Show resolved Hide resolved
docker/synapse3_10.Dockerfile Outdated Show resolved Hide resolved
docker/synapse3_10.Dockerfile Outdated Show resolved Hide resolved
docker/synapse3_10.Dockerfile Outdated Show resolved Hide resolved
@H-Shay
Copy link
Contributor Author

H-Shay commented Feb 4, 2022

So I have managed to ditch the custom dockerfile for python 3.10 and achieve the same result using a build arg passed to the generic synapse dockerfile. However, I was unable to figure out how to add this particular build to the strategy matrix: in particular, I could not figure out how to pass an extra build arg for python 3.10 in that one case. I am sure there is something very simple I am missing, but I banged my head against the wall long enough that's time to ask.

Edit: ignore me, I am an idiot and figured out the matrix out soon after I wrote this. I think this should be good to go now.

@H-Shay H-Shay requested a review from richvdh February 4, 2022 22:40
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, a few more tweaks!

.github/workflows/docker.yml Outdated Show resolved Hide resolved
.github/workflows/docker.yml Outdated Show resolved Hide resolved
@@ -57,15 +59,25 @@ jobs:
- sytest_image_tag: focal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old sytest_image_tag variables seem to be unused now. Could you get rid of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe they are still being used on line 54?:

  name: "Build sytest-${{ matrix.dockerfile }}:${{ matrix.sytest_image_tag }}"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah. Hrm, that's not ideal - they are bound to get out of sync.

Not sure I've got any better ideas right now though. Let's ship it!

.github/workflows/pipeline.yml Outdated Show resolved Hide resolved
@H-Shay H-Shay requested a review from richvdh February 8, 2022 22:12
@@ -57,15 +59,25 @@ jobs:
- sytest_image_tag: focal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah. Hrm, that's not ideal - they are bound to get out of sync.

Not sure I've got any better ideas right now though. Let's ship it!

@H-Shay H-Shay merged commit 1744842 into develop Feb 10, 2022
@H-Shay H-Shay deleted the shay/add_python3.10 branch February 10, 2022 19:36
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.

3 participants