Skip to content

Commit

Permalink
Image - Check multiplatform build support against docker version (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
alonmr committed Apr 5, 2023
1 parent e4cb378 commit c2b4bb4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7

Expand All @@ -29,10 +29,10 @@ jobs:
unit_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7

Expand All @@ -45,10 +45,10 @@ jobs:
integration_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7

Expand Down
12 changes: 12 additions & 0 deletions manof/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pipes
import inspect
import re
import semver

from twisted.internet import defer

Expand Down Expand Up @@ -861,6 +862,17 @@ def _disconnect_container_from_network(self, container_name, network):
@defer.inlineCallbacks
def _daemon_supports_multiplatform_build(self):

# multiplatform build is not experimental from 20.10.21
out, _, _ = yield self._run_command(
'docker version --format \'{{.Client.Version}}\''
)
try:
if out and semver.Version.parse(out) >= semver.Version.parse('20.10.21'):
defer.returnValue(True)

except ValueError:
pass

# There are 2 lines with the key Experimental - one for the server and one for the client.
# They both need to be true for the multiplatform build to be supported
out, _, _ = yield self._run_command('docker version | grep Experimental')
Expand Down
1 change: 1 addition & 0 deletions requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ colorama==0.4.5
pygments==2.13.0
ruamel.yaml==0.17.21
setuptools==67.3.3
semver==3.0.0

0 comments on commit c2b4bb4

Please sign in to comment.