zuul-jobs/test-playbooks/ensure-python-pyenv-python-version.yaml
Monty Taylor 7a58814cda Support .python-version files in ensure-python
We have support for installing python from pyenv, but it currently
requires setting the python version explicitly as an argument. If
the repo in question has a .python-version file, we shouldn't need to
require the user to provide that version a second time. Instead, we can
read from the file for the install step.

Change-Id: Ic4c2d3fc7f55169cec5211010fc3a9622fa324d1
2024-06-25 14:30:46 -07:00

19 lines
564 B
YAML

- hosts: all
tasks:
- name: Create a python-version file with a python version in it
delegate_to: localhost
copy:
content: 3.11
dest: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/.python-version"
- name: Include ensure-python role
include_role:
name: ensure-python
vars:
python_use_pyenv: true
- name: Check installed version of Python
command: /usr/local/bin/python3 --version
register: _check_version
failed_when: "'Python 3.11' not in _check_version.stdout"