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

The recent changes to postinstall breaks custom pip install #166

Closed
janorn opened this issue Jul 10, 2023 · 14 comments
Closed

The recent changes to postinstall breaks custom pip install #166

janorn opened this issue Jul 10, 2023 · 14 comments

Comments

@janorn
Copy link

janorn commented Jul 10, 2023

when:
- docker_network_access | bool
- (docker_sdk | bool) or (docker_stack | bool) or (docker_compose | bool)

@janorn
Copy link
Author

janorn commented Jul 10, 2023

I.e running with the version 5.0 with these parameters will not trigger postinstall.

docker_additional_packages_pip
docker_additional_packages_os
docker_x_skip_pip_auto_upgrade

I install the docker python module using this instead of forcing pip upgrades.

@janorn
Copy link
Author

janorn commented Jul 10, 2023

Could we perhaps have a or (docker_postinstall | bool)?

@haxorof
Copy link
Owner

haxorof commented Jul 10, 2023

Hmm that is not really the intention to use it like that but can you tell me exactly what you specify in those variables?

@janorn
Copy link
Author

janorn commented Jul 11, 2023

docker_additional_packages_pip:
  - certifi{{ '==2021.10.8' if ansible_python_version is version('3', '<') else '' }}
  - requests{{ '<2.28,>=2.14.2' if ansible_python_version is version('3', '<') else '' }}
  - urllib3{{ '<2' if ansible_python_version is version('3', '<') else '' }}
  - websocket-client{{ '<1' if ansible_python_version is version('3', '<') else '' }}
  - docker{{ '<5' if ansible_python_version is version('3', '<') else '' }}

Packages for Centos7

docker_additional_packages_os:
  - python2-pip
  - python-psycopg2
  - python2-backports-shutil_get_terminal_size

For more recent

docker_additional_packages_os:
  - python3-pip
  - python3-psycopg2

@haxorof
Copy link
Owner

haxorof commented Jul 11, 2023

What would be the difference if you just skip the line with docker in docker_additional_packages_pip and just set docker_sdk to true?

In the role I have docker{{ '<5' if ansible_python_version is version('3', '<') }} so the result would be the same or?

@janorn
Copy link
Author

janorn commented Jul 12, 2023

With the old pip in Centos 7 it will pull wrong versions of the dependencies and fail before it reaches the docker sdk.

I will drop centos 7 soon but unfortunately we still have some old environments.

@haxorof
Copy link
Owner

haxorof commented Jul 12, 2023

I want to do a test in the testing I do for this role before deciding on what to do.

For the listed pip packages you earlier provided in the variable, can you give me the versions you see of those when looking at pip freeze?

@janorn
Copy link
Author

janorn commented Jul 13, 2023

The uppger limits are set to avoid those.

@haxorof
Copy link
Owner

haxorof commented Jul 13, 2023

Okay thanks! I will just have to test this then and see, will do that next week. Just just cannot see right now what really is the problem using docker_sdk since I have the same upper limit as you and do not automatically upgrade the other mentioned pip packages explicitly at least what I can see right now.

@janorn
Copy link
Author

janorn commented Jul 13, 2023

But don't you upgrade pip? One more thing though. Some of our servers can't connect to pypi so I mirror the git repos and point the list towards those repos instead don't think that is possible with your sdk option.

@haxorof
Copy link
Owner

haxorof commented Jul 13, 2023

It should not do the upgrade if you set the configuration not to do it. What I plan to test next week is the following and I think it would be equal to what you have today:

docker_x_skip_pip_auto_upgrade: yes
docker_pip_upgrade: no
docker_sdk: yes
docker_additional_packages_pip:
  - certifi{{ '==2021.10.8' if ansible_python_version is version('3', '<') else '' }}
  - requests{{ '<2.28,>=2.14.2' if ansible_python_version is version('3', '<') else '' }}
  - urllib3{{ '<2' if ansible_python_version is version('3', '<') else '' }}
  - websocket-client{{ '<1' if ansible_python_version is version('3', '<') else '' }}
docker_additional_packages_os:
  - python2-pip
  - python-psycopg2
  - python2-backports-shutil_get_terminal_size

@haxorof
Copy link
Owner

haxorof commented Jul 21, 2023

I tested the configuration in previous comment and noticed that packages that you are specifying are packages that some docker depends on. Therefore the order becomes important here and in my role I installed the additional packages after "docker<5" which then causes the issue where it tries to install requests package for Python 3.7.

I have done a change of the ordering on master now. Could you see if that works for you? If not then just keep using version 4.0.0 on your machine if you do not have a big need for the breaking changes I did in the 5.0.0 version.

If you test what is now on master and it works I can create a bug fix version to be published to galaxy.

@janorn
Copy link
Author

janorn commented Jul 31, 2023

I did a quick test and it seems to work for centos 7. Ran into some Ansible-lint issues with rocky9. Need to fix that to be able to validate the whole build pipeline.

@haxorof
Copy link
Owner

haxorof commented Jul 31, 2023

Released 5.0.1 so it is available in Ansible galaxy

@haxorof haxorof closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants