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

Stop hardcoding the default Docker version #445

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions shub/image/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from importlib import metadata


DEFAULT_DOCKER_API_VERSION = '1.21'
STATUS_FILE_LOCATION = '.releases'
_VALIDSPIDERNAME = re.compile('^[a-z0-9][-._a-z0-9]+$', re.I)

Expand All @@ -39,10 +38,10 @@
docker version

and check its output: it should contain Docker client and server versions and
should not contain any errors. The minimum API Version is: {}
should not contain any errors.

You can learn about Docker at https://www.docker.com/.
""".format(DEFAULT_DOCKER_API_VERSION)
"""


def is_verbose():
Expand Down Expand Up @@ -103,7 +102,7 @@ def get_docker_client(validate=True):
verify=apply_path_fun('ca.pem'),
assert_hostname=False)
docker_host = docker_host.replace('tcp://', 'https://')
version = os.environ.get('DOCKER_API_VERSION', DEFAULT_DOCKER_API_VERSION)
version = os.environ.get('DOCKER_API_VERSION', 'auto')

# If it returns an error, check if you have the old docker-py installed
# together with the new docker lib, and uninstall docker-py.
Expand Down
4 changes: 1 addition & 3 deletions tests/image/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
load_status_url,
store_status_url,
STATUS_FILE_LOCATION,
DEFAULT_DOCKER_API_VERSION,
)

from .utils import FakeProjectDirectory, add_sh_fake_config
Expand Down Expand Up @@ -44,8 +43,7 @@ def version(self):

mocked_docker.APIClient = DockerClientMock
assert get_docker_client()
client_mock.assert_called_with(
base_url=None, tls=None, version=DEFAULT_DOCKER_API_VERSION)
client_mock.assert_called_with(base_url=None, tls=None, version='auto')
# set basic test environment
os.environ['DOCKER_HOST'] = 'http://127.0.0.1'
os.environ['DOCKER_API_VERSION'] = '1.40'
Expand Down
Loading