mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Try to fix docker tests (#764)
* Try to limit docker package version if API version is < 1.39.
* Fix error.
* Re-combine to one command.
(cherry picked from commit a00d615d68
)
This commit is contained in:
parent
99265c5126
commit
dc9cab36ac
3 changed files with 15 additions and 4 deletions
|
@ -7,8 +7,8 @@ docker_packages:
|
|||
- docker-ce
|
||||
|
||||
docker_pip_extra_packages: []
|
||||
docker_pip_packages:
|
||||
- docker
|
||||
docker_pip_package: docker
|
||||
docker_pip_package_limit: ''
|
||||
|
||||
docker_cleanup_packages:
|
||||
- docker
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- name: remove pip packages
|
||||
pip:
|
||||
state: present
|
||||
name: "{{ docker_pip_packages | union(docker_pip_extra_packages) }}"
|
||||
name: "{{ [docker_pip_package] | union(docker_pip_extra_packages) }}"
|
||||
listen: cleanup docker
|
||||
when: not docker_skip_cleanup | bool
|
||||
|
||||
|
|
|
@ -27,10 +27,21 @@
|
|||
paths:
|
||||
- "{{ role_path }}/tasks"
|
||||
|
||||
# Detect docker API version
|
||||
- name: Check Docker API version
|
||||
command: "docker version -f {% raw %}'{{(index .Server.Components 0).Details.ApiVersion}}'{% endraw %}"
|
||||
register: docker_api_version_stdout
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Limit docker pypi package version to < 4.3.0
|
||||
set_fact:
|
||||
docker_pip_package_limit: '<4.3.0'
|
||||
when: (docker_api_version_stdout.stdout | default('0.0')) is version('1.39', '<')
|
||||
|
||||
- name: Install Python requirements
|
||||
pip:
|
||||
state: present
|
||||
name: "{{ docker_pip_packages | union(docker_pip_extra_packages) }}"
|
||||
name: "{{ [docker_pip_package ~ docker_pip_package_limit] + docker_pip_extra_packages }}"
|
||||
extra_args: "-c {{ remote_constraints }}"
|
||||
notify: cleanup docker
|
||||
|
||||
|
|
Loading…
Reference in a new issue