zuul-jobs/roles/ensure-twine/tasks/main.yaml
Guillaume Chauvel d370c590b3 ensure-twine: Check executable presence using shell+bin/bash
While making test with a node:
- with tox installed using "pip install --user" as a non-root user
- PATH modified using ~/.ssh/environment
- declared in nodepool to run as this non-root user

twine executable is not found:

using "command": twine is not found
using "shell" without /bin/bash: twine is not found
using "shell" with /bin/bash: twine is found!

Change-Id: Ia06218a830b5d44f04e0f10e0444be2cf9ad682e
2020-05-30 22:58:06 +02:00

23 lines
649 B
YAML

- name: Check for twine install
shell: |
command -v {{ twine_executable }} || exit 1
args:
executable: /bin/bash
failed_when: false
register: register_twine
- name: Set pypi_twine_executable
set_fact:
pypi_twine_executable: "{{ register_twine.stdout }}"
when: register_twine.rc == 0
- name: Ensure twine is installed
block:
- name: Ensure twine is installed
command: "{{ twine_python }} -m pip install twine!=1.12.0 readme_renderer[md]!=23.0 requests-toolbelt!=0.9.0 --user"
- name: Set pypi_twine_executable
set_fact:
pypi_twine_executable: ~/.local/bin/twine
when: register_twine.rc != 0