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

CI: Pin requests' version less than 2.32 #382

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions tests/e2e/ansible/start_docker_registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,15 @@
state: present
retries: 3
delay: 10
# The docker pip is needed by the docker_container ansible module itself.
- name: Install docker pip
# The docker and requests pip packages are required by the docker_container ansible module itself.
# The requests package is pinned to a version less than 2.32 to avoid a bug
# at https://github.com/docker/docker-py/issues/3256
- name: Install docker and requests pip packages
pip:
name: docker
# Due to a bug in requests 2.29.0 we need to downgrade it
# see https://github.com/docker/docker-py/issues/3113
- name: Downgrade requests
shell: |
actual_version="$(pip3 show requests | grep Version | cut -d: -f2 | xargs)"
version_ge="$(echo -e "2.29.0\n$actual_version" | sort -V | head -1)"
Copy link
Member

Choose a reason for hiding this comment

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

The other day I was looking for this exact line and I couldn't find. This is a good way to compare semver numbers in bash. So long lovely code, so long!

if [ "$version_ge" = "2.29.0" ]; then
pip3 install requests==2.28.1
fi
name:
- docker
- requests<2.32
Copy link
Member

Choose a reason for hiding this comment

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

And I didn't know we could specify '<', '>', ...., in this command. Cool!

state: present
retries: 3
delay: 10
- name: Start a docker registry
Expand Down
Loading