The following are some gotchas when setting up specific Python versions on GitHub self-hosted runners which are based on AWS official AMIs and container images.
-
Official Amazon Linux 2 AMI and official Amazon Linux 2 container image do not have the same Python runtimes setup.
- Amazon Linux 2 AMI (ECS-optimized AMI
/aws/service/ecs/optimized-ami/amazon-linux-2/recommended) haspython2.7andpython3.7by default. - Amazon Linux 2 container image amazonlinux/amazonlinux (
public.ecr.aws/amazonlinux/amazonlinux) has onlypython2.7; it does not havepython3/pipinstalled by default.
- Amazon Linux 2 AMI (ECS-optimized AMI
Amazon Linux 2 AMI has
python3pointed topython3.7by default. When changingpython3to point to other Python3 version (e.g. settingupdate-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1), it may breakcfn-signalso no signal will be sent to ASG at EC2 launch (i.e. no healthy instances will be registered).
Note that this will be an issue if you use ASG for the runners (not ECS Fargate).-
Keep
pythonto point topython2.7, asyumdoes not support Python3. You will see this error if settingpythonto point to Python3:
> yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntaxSee also https://stackoverflow.com/questions/11213520/yum-crashed-with-keyboard-interrupt-error.
actions/setup-python@v4does not supportarm64(https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json).
See related Open issue https://github.com/actions/setup-python/issues/108.
Note: (3) and (4) are not Amazon Linux specific. Just issues experienced when building the Amazon official image based self-hosted runners.
Top comments (0)