Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
d1b51c39
Kaydet (Commit)
d1b51c39
authored
Ock 28, 2017
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Ock 28, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1421 from shin-/add_stop_timeout
Add stop_timeout to create_container
üst
0186456f
847f2098
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
8 deletions
+31
-8
Jenkinsfile
Jenkinsfile
+2
-4
container.py
docker/api/container.py
+4
-1
containers.py
docker/types/containers.py
+7
-0
helpers.py
tests/helpers.py
+5
-3
api_build_test.py
tests/integration/api_build_test.py
+4
-0
api_container_test.py
tests/integration/api_container_test.py
+9
-0
No files found.
Jenkinsfile
Dosyayı görüntüle @
d1b51c39
...
...
@@ -36,15 +36,14 @@ def buildImages = { ->
def
getAPIVersion
=
{
engineVersion
->
def
versionMap
=
[
'1.12'
:
'1.24'
,
'1.13'
:
'1.25'
]
engineVersion
=
engineVersion
.
substring
(
0
,
4
)
return
versionMap
[
engineVersion
]
return
versionMap
[
engineVersion
.
substring
(
0
,
4
)]
}
def
runTests
=
{
Map
settings
->
def
dockerVersion
=
settings
.
get
(
"dockerVersion"
,
null
)
def
pythonVersion
=
settings
.
get
(
"pythonVersion"
,
null
)
def
testImage
=
settings
.
get
(
"testImage"
,
null
)
def
apiVersion
=
getAPIVersion
(
dockerVersion
)
if
(!
testImage
)
{
throw
new
Exception
(
"Need test image object, e.g.: `runTests(testImage: img)`"
)
...
...
@@ -62,7 +61,6 @@ def runTests = { Map settings ->
checkout
(
scm
)
def
dindContainerName
=
"dpy-dind-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
def
testContainerName
=
"dpy-tests-\$BUILD_NUMBER-\$EXECUTOR_NUMBER-${pythonVersion}-${dockerVersion}"
def
apiVersion
=
getAPIVersion
(
dockerVersion
)
try
{
sh
"""docker run -d --name ${dindContainerName} -v /tmp --privileged \\
dockerswarm/dind:${dockerVersion} docker daemon -H tcp://0.0.0.0:2375
...
...
docker/api/container.py
Dosyayı görüntüle @
d1b51c39
...
...
@@ -238,7 +238,7 @@ class ContainerApiMixin(object):
memswap_limit
=
None
,
cpuset
=
None
,
host_config
=
None
,
mac_address
=
None
,
labels
=
None
,
volume_driver
=
None
,
stop_signal
=
None
,
networking_config
=
None
,
healthcheck
=
None
):
healthcheck
=
None
,
stop_timeout
=
None
):
"""
Creates a container. Parameters are similar to those for the ``docker
run`` command except it doesn't support the attach options (``-a``).
...
...
@@ -411,6 +411,8 @@ class ContainerApiMixin(object):
volume_driver (str): The name of a volume driver/plugin.
stop_signal (str): The stop signal to use to stop the container
(e.g. ``SIGINT``).
stop_timeout (int): Timeout to stop the container, in seconds.
Default: 10
networking_config (dict): A networking configuration generated
by :py:meth:`create_networking_config`.
...
...
@@ -437,6 +439,7 @@ class ContainerApiMixin(object):
network_disabled
,
entrypoint
,
cpu_shares
,
working_dir
,
domainname
,
memswap_limit
,
cpuset
,
host_config
,
mac_address
,
labels
,
volume_driver
,
stop_signal
,
networking_config
,
healthcheck
,
stop_timeout
)
return
self
.
create_container_from_config
(
config
,
name
)
...
...
docker/types/containers.py
Dosyayı görüntüle @
d1b51c39
...
...
@@ -438,6 +438,7 @@ class ContainerConfig(dict):
working_dir
=
None
,
domainname
=
None
,
memswap_limit
=
None
,
cpuset
=
None
,
host_config
=
None
,
mac_address
=
None
,
labels
=
None
,
volume_driver
=
None
,
stop_signal
=
None
,
networking_config
=
None
,
healthcheck
=
None
,
stop_timeout
=
None
):
if
isinstance
(
command
,
six
.
string_types
):
command
=
split_command
(
command
)
...
...
@@ -466,6 +467,11 @@ class ContainerConfig(dict):
'stop_signal was only introduced in API version 1.21'
)
if
stop_timeout
is
not
None
and
version_lt
(
version
,
'1.25'
):
raise
errors
.
InvalidVersion
(
'stop_timeout was only introduced in API version 1.25'
)
if
healthcheck
is
not
None
and
version_lt
(
version
,
'1.24'
):
raise
errors
.
InvalidVersion
(
'Health options were only introduced in API version 1.24'
...
...
@@ -584,4 +590,5 @@ class ContainerConfig(dict):
'VolumeDriver'
:
volume_driver
,
'StopSignal'
:
stop_signal
,
'Healthcheck'
:
healthcheck
,
'StopTimeout'
:
stop_timeout
})
tests/helpers.py
Dosyayı görüntüle @
d1b51c39
...
...
@@ -43,10 +43,12 @@ def untar_file(tardata, filename):
def
requires_api_version
(
version
):
test_version
=
os
.
environ
.
get
(
'DOCKER_TEST_API_VERSION'
,
docker
.
constants
.
DEFAULT_DOCKER_API_VERSION
)
return
pytest
.
mark
.
skipif
(
docker
.
utils
.
version_lt
(
docker
.
constants
.
DEFAULT_DOCKER_API_VERSION
,
version
),
docker
.
utils
.
version_lt
(
test_version
,
version
),
reason
=
"API version is too low (< {0})"
.
format
(
version
)
)
...
...
tests/integration/api_build_test.py
Dosyayı görüntüle @
d1b51c39
...
...
@@ -3,6 +3,7 @@ import os
import
shutil
import
tempfile
import
pytest
import
six
from
docker
import
errors
...
...
@@ -154,9 +155,11 @@ class BuildTest(BaseAPIIntegrationTest):
self
.
assertEqual
(
info
[
'Config'
][
'Labels'
],
labels
)
@requires_api_version
(
'1.25'
)
@pytest.mark.xfail
(
reason
=
'Bad test'
)
def
test_build_cachefrom
(
self
):
script
=
io
.
BytesIO
(
'
\n
'
.
join
([
'FROM scratch'
,
'CMD sh -c "echo
\'
Hello, World!
\'
"'
,
])
.
encode
(
'ascii'
))
cachefrom
=
[
'build1'
]
...
...
@@ -169,6 +172,7 @@ class BuildTest(BaseAPIIntegrationTest):
pass
info
=
self
.
client
.
inspect_image
(
'cachefrom'
)
# FIXME: Config.CacheFrom is not a real thing
self
.
assertEqual
(
info
[
'Config'
][
'CacheFrom'
],
cachefrom
)
def
test_build_stderr_data
(
self
):
...
...
tests/integration/api_container_test.py
Dosyayı görüntüle @
d1b51c39
...
...
@@ -413,6 +413,15 @@ class CreateContainerTest(BaseAPIIntegrationTest):
config
=
self
.
client
.
inspect_container
(
container
)
assert
config
[
'HostConfig'
][
'AutoRemove'
]
is
True
@requires_api_version
(
'1.25'
)
def
test_create_with_stop_timeout
(
self
):
container
=
self
.
client
.
create_container
(
BUSYBOX
,
[
'echo'
,
'test'
],
stop_timeout
=
25
)
self
.
tmp_containers
.
append
(
container
[
'Id'
])
config
=
self
.
client
.
inspect_container
(
container
)
assert
config
[
'Config'
][
'StopTimeout'
]
==
25
class
VolumeBindTest
(
BaseAPIIntegrationTest
):
def
setUp
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment