Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Odoo scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo scripts
Commits
59171554
Commit
59171554
authored
3 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
docker_build: tag if present, and push
parent
1eb9dd7e
No related branches found
No related tags found
1 merge request
!68
🔖 14.0.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NEWS.rst
+4
-0
4 additions, 0 deletions
NEWS.rst
odoo_scripts/docker_build.py
+27
-10
27 additions, 10 deletions
odoo_scripts/docker_build.py
with
31 additions
and
10 deletions
NEWS.rst
+
4
−
0
View file @
59171554
...
...
@@ -7,6 +7,10 @@
Allow not setting the database owner in do_tests.
Remove static image support.
``docker_build`` also tag with any current tag if any.
13.3.0
------
...
...
This diff is collapsed.
Click to expand it.
odoo_scripts/docker_build.py
+
27
−
10
View file @
59171554
...
...
@@ -18,5 +18,5 @@
_logger
=
logging
.
getLogger
(
__name__
)
__version__
=
"
1.
0
.0
"
__version__
=
"
1.
1
.0
"
__date__
=
"
2018-04-04
"
...
...
@@ -22,5 +22,5 @@
__date__
=
"
2018-04-04
"
__updated__
=
"
202
0-09-11
"
__updated__
=
"
202
1-12-13
"
def
__parser
():
...
...
@@ -34,7 +34,7 @@
program_license
=
"""
%s
Created by Vincent Hatakeyama on %s.
Copyright 2018, 2019, 2020 XCG Consulting. All rights reserved.
Copyright 2018, 2019, 2020
, 2021
XCG Consulting. All rights reserved.
Licensed under the MIT License
...
...
@@ -101,8 +101,8 @@
registry
=
c
.
registry
project
=
c
.
image
odoo_type
=
c
.
odoo_type
image
=
"
%s/%s:latest
"
%
(
registry
,
project
)
_logger
.
debug
(
"
Docker
image: %s
"
,
image
)
repository
=
f
"
{
registry
}
/
{
project
}
"
_logger
.
debug
(
"
Docker
repository: %s
"
,
repository
)
# TODO ensureconf
if
ensureconf
:
raise
NotImplementedError
...
...
@@ -118,6 +118,9 @@
signal
.
signal
(
signal
.
SIGINT
,
signal_handler
)
signal
.
signal
(
signal
.
SIGTERM
,
signal_handler
)
# used to retag
tags
=
[]
buildargs
=
dict
()
if
os
.
path
.
exists
(
"
.hg
"
):
tags
=
check_output
([
"
hg
"
,
"
identify
"
,
"
--tags
"
]).
decode
()
...
...
@@ -121,4 +124,6 @@
buildargs
=
dict
()
if
os
.
path
.
exists
(
"
.hg
"
):
tags
=
check_output
([
"
hg
"
,
"
identify
"
,
"
--tags
"
]).
decode
()
buildargs
[
"
VERSION
"
]
=
tags
buildargs
[
"
SENTRY_RELEASE
"
]
=
tags
if
tags
:
...
...
@@ -124,5 +129,5 @@
if
tags
:
buildargs
[
"
VERSION
"
]
=
tags
tags
=
tags
.
split
()
buildargs
[
"
VCS_URL
"
]
=
check_output
(
[
"
hg
"
,
"
paths
"
,
"
default
"
]
).
decode
()
...
...
@@ -181,7 +186,7 @@
rm
=
True
,
pull
=
pull
,
buildargs
=
buildargs
,
tag
=
image
,
tag
=
repository
,
dockerfile
=
dockerfile
,
)
for
line
in
builder
:
...
...
@@ -194,4 +199,8 @@
return
1
if
dev
:
call
([
"
rm
"
,
dockerfile
])
# retag
for
tag
in
tags
:
_logger
.
info
(
"
Docker with tag %s
"
,
tag
)
docker_client
.
images
.
get
(
repository
).
tag
(
repository
,
tag
=
tag
)
...
...
@@ -197,4 +206,2 @@
# TODO docker tag with tags/bookmarks (unused so maybe no need)
# TODO docker push (only when asked for)
if
push
:
...
...
@@ -200,5 +207,15 @@
if
push
:
raise
NotImplementedError
_logger
.
info
(
"
Docker push %s
"
,
repository
)
for
line
in
docker_client
.
images
.
push
(
repository
,
stream
=
True
,
decode
=
True
):
_logger
.
debug
(
line
)
for
tag
in
tags
:
_logger
.
info
(
"
Docker push %s:%s
"
,
repository
,
tag
)
for
line
in
docker_client
.
images
.
push
(
repository
,
tag
=
tag
,
stream
=
True
,
decode
=
True
):
_logger
.
debug
(
line
)
# XXX call cleanup more intelligently
signal_handler
(
0
,
None
)
return
0
...
...
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