Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.core
Commits
f626332a
Commit
f626332a
authored
8 years ago
by
Philip ABBET
Browse files
Options
Downloads
Patches
Plain Diff
Add a priority mechanism for docker images providing the same environments
parent
a02e52d5
No related branches found
No related tags found
1 merge request
!13
Merge docker-related changes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/core/dock.py
+57
-6
57 additions, 6 deletions
beat/core/dock.py
with
57 additions
and
6 deletions
beat/core/dock.py
+
57
−
6
View file @
f626332a
...
@@ -68,7 +68,7 @@ class Host(object):
...
@@ -68,7 +68,7 @@ class Host(object):
self
.
client
=
docker
.
Client
(
**
self
.
kwargs
)
self
.
client
=
docker
.
Client
(
**
self
.
kwargs
)
self
.
environments
=
self
.
_discover_environments
(
raise_on_errors
=
Tru
e
)
self
.
environments
=
self
.
_discover_environments
(
raise_on_errors
=
Fals
e
)
# makes sure we can talk to the docker host
# makes sure we can talk to the docker host
assert
self
.
ip
assert
self
.
ip
...
@@ -165,11 +165,62 @@ class Host(object):
...
@@ -165,11 +165,62 @@ class Host(object):
"
uniquely named. Fix this and re-start.
"
%
\
"
uniquely named. Fix this and re-start.
"
%
\
(
tag
or
id
,
retval
[
key
][
'
image
'
],
key
))
(
tag
or
id
,
retval
[
key
][
'
image
'
],
key
))
else
:
else
:
logger
.
warn
(
"
Overriding **existing** environment `%s
'
image
"
\
new_version
=
None
"
with `%s
'
(it was `%s). To avoid this warning make
"
\
previous_version
=
None
"
sure your docker images do not contain environments
"
\
"
with the same names
"
,
key
,
retval
[
key
][
'
image
'
],
parts
=
tag
.
split
(
'
/
'
)
image
[
'
Id
'
])
if
len
(
parts
)
>
1
:
parts
=
parts
[
-
1
].
split
(
'
:
'
)
if
len
(
parts
)
>
1
:
new_version
=
parts
[
-
1
]
parts
=
retval
[
key
][
'
tag
'
].
split
(
'
/
'
)
if
len
(
parts
)
>
1
:
parts
=
parts
[
-
1
].
split
(
'
:
'
)
if
len
(
parts
)
>
1
:
previous_version
=
parts
[
-
1
]
replacement
=
False
keep
=
False
if
(
new_version
is
not
None
)
and
(
previous_version
is
not
None
):
if
new_version
==
'
latest
'
:
replacement
=
True
elif
previous_version
==
'
latest
'
:
keep
=
True
else
:
try
:
new_version
=
tuple
([
int
(
x
)
for
x
in
new_version
.
split
(
'
.
'
)
])
try
:
previous_version
=
tuple
([
int
(
x
)
for
x
in
previous_version
.
split
(
'
.
'
)
])
if
new_version
>
previous_version
:
replacement
=
True
else
:
keep
=
True
except
:
replacement
=
True
except
:
keep
=
True
elif
new_version
is
not
None
:
replacement
=
True
elif
previous_version
is
not
None
:
keep
=
True
if
replacement
:
logger
.
debug
(
"
Overriding **existing** environment `%s
'
in image `%s
'"
,
key
,
retval
[
key
][
'
tag
'
])
elif
keep
:
logger
.
debug
(
"
Environment `%s
'
already existing in image `%s
'
, we
'
ll keep it
"
,
key
,
retval
[
key
][
'
tag
'
])
continue
else
:
logger
.
warn
(
"
Overriding **existing** environment `%s
'
image
"
\
"
with `%s
'
(it was `%s). To avoid this warning make
"
\
"
sure your docker images do not contain environments
"
\
"
with the same names
"
,
key
,
retval
[
key
][
'
image
'
],
image
[
'
Id
'
])
retval
[
key
]
=
description
retval
[
key
]
=
description
retval
[
key
][
'
image
'
]
=
image
[
'
Id
'
]
retval
[
key
][
'
image
'
]
=
image
[
'
Id
'
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment