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
a453aeff
Kaydet (Commit)
a453aeff
authored
May 05, 2017
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge branch 'aaronthebaron-1577-multi-success-message'
üst
36b2d814
431f7c64
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
images.py
docker/models/images.py
+15
-12
models_images_test.py
tests/integration/models_images_test.py
+9
-0
No files found.
docker/models/images.py
Dosyayı görüntüle @
a453aeff
...
...
@@ -166,18 +166,21 @@ class ImageCollection(Collection):
resp
=
self
.
client
.
api
.
build
(
**
kwargs
)
if
isinstance
(
resp
,
six
.
string_types
):
return
self
.
get
(
resp
)
events
=
list
(
json_stream
(
resp
))
if
not
events
:
return
BuildError
(
'Unknown'
)
event
=
events
[
-
1
]
if
'stream'
in
event
:
match
=
re
.
search
(
r'(Successfully built |sha256:)([0-9a-f]+)'
,
event
.
get
(
'stream'
,
''
))
if
match
:
image_id
=
match
.
group
(
2
)
return
self
.
get
(
image_id
)
raise
BuildError
(
event
.
get
(
'error'
)
or
event
)
last_event
=
None
for
chunk
in
json_stream
(
resp
):
if
'error'
in
chunk
:
raise
BuildError
(
chunk
[
'error'
])
if
'stream'
in
chunk
:
match
=
re
.
search
(
r'(Successfully built |sha256:)([0-9a-f]+)'
,
chunk
[
'stream'
]
)
if
match
:
image_id
=
match
.
group
(
2
)
return
self
.
get
(
image_id
)
last_event
=
chunk
raise
BuildError
(
last_event
or
'Unknown'
)
def
get
(
self
,
name
):
"""
...
...
tests/integration/models_images_test.py
Dosyayı görüntüle @
a453aeff
...
...
@@ -28,6 +28,15 @@ class ImageCollectionTest(BaseIntegrationTest):
assert
str
(
cm
.
exception
)
==
(
"Unknown instruction: "
"NOTADOCKERFILECOMMAND"
)
def
test_build_with_multiple_success
(
self
):
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
image
=
client
.
images
.
build
(
tag
=
'some-tag'
,
fileobj
=
io
.
BytesIO
(
"FROM alpine
\n
"
"CMD echo hello world"
.
encode
(
'ascii'
)
))
self
.
tmp_imgs
.
append
(
image
.
id
)
assert
client
.
containers
.
run
(
image
)
==
b
"hello world
\n
"
def
test_list
(
self
):
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
image
=
client
.
images
.
pull
(
'alpine:latest'
)
...
...
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