Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
docker-cubicweb
Commits
f777462847b8
Commit
f940911d
authored
Mar 12, 2021
by
Noé Gaumont
🐙
Browse files
fix: remove MATRIX and ALIASES
parent
c220f416812d
Changes
1
Hide whitespace changes
Inline
Side-by-side
build.py
View file @
f7774628
...
...
@@ -6,6 +6,13 @@ import sys
import
logging
from
dataclasses
import
dataclass
from
typing
import
Optional
,
List
from
itertools
import
product
LOG
=
logging
.
getLogger
(
__name__
)
REGISTRY
=
'logilab/cubicweb'
CWREPO
=
'https://forge.extranet.logilab.fr/cubicweb/cubicweb/'
@
dataclass
class
CubicWebImage
:
...
...
@@ -23,10 +30,11 @@ class CubicWebImage:
return
self
.
cubicweb_version
.
rsplit
(
'.'
,
1
)[
0
]
def
__le__
(
self
,
other
):
lversion
=
self
.
cubicweb_version
.
split
(
"."
)
rversion
=
other
.
cubicweb_version
.
split
(
"."
)
lversion
=
[
int
(
v
)
for
v
in
self
.
cubicweb_version
.
split
(
"."
)
]
rversion
=
[
int
(
v
)
for
v
in
other
.
cubicweb_version
.
split
(
"."
)
]
return
lversion
<=
rversion
def
__gt__
(
self
,
other
):
return
not
self
<=
other
...
...
@@ -47,26 +55,6 @@ class CubicWebImage:
return
f
"
{
REGISTRY
}
:
{
self
.
base_docker_image
}
-
{
self
.
cubicweb_major_version
}
"
LOG
=
logging
.
getLogger
(
__name__
)
REGISTRY
=
'logilab/cubicweb'
CWREPO
=
'https://forge.extranet.logilab.fr/cubicweb/cubicweb/'
MATRIX
=
[
# (['py27'], ['stretch', 'buster'], [None, '3.25', '3.26'],
# [None, 'onbuild']),
# (['py35'], ['stretch'], [None, '3.26', '3.27'], [None, 'onbuild']),
([
'py37'
],
[
'buster'
],
[
'3.29'
],
[
None
,
'onbuild'
]),
]
ALIASES
=
(
# ('3.25', 'py27-buster-3.25'),
# ('3.26', 'py37-buster-3.26'),
# ('3.27', 'py37-buster-3.27'),
# ('3.28', 'py37-buster-3.28'),
(
'3.29'
,
'py37-buster-3.29'
),
# ('dev', 'py37-buster-dev'),
# ('latest', 'py37-buster-3.29'),
(
'buildpackage'
,
'buster-buildpackage'
),
)
def
run
(
*
args
):
LOG
.
info
(
'%s'
,
' '
.
join
(
args
))
...
...
@@ -93,13 +81,15 @@ def _cwdev(_cache={}):
def
get_major_tags
(
images
:
List
[
CubicWebImage
]):
latest
=
{}
for
cwimage
in
[
img
for
img
in
images
if
img
.
package_version
!=
'dev'
]:
for
cwimage
in
images
:
if
cwimage
.
package_version
==
'dev'
:
continue
version
=
cwimage
.
cubicweb_major_version
if
version
not
in
latest
:
latest
[
version
]
=
cwimage
else
:
if
latest
[
version
]
<=
cwimage
:
latest
[
version
]
=
cwimage
elif
latest
[
version
]
<=
cwimage
:
latest
[
version
]
=
cwimage
last_major
=
max
(
latest
.
values
())
latest
[
'latest'
]
=
last_major
return
latest
...
...
@@ -121,7 +111,7 @@ def tag_aliases(images: List[CubicWebImage], last_debian_dist: str):
check_call
(
'docker'
,
'tag'
,
f
'
{
REGISTRY
}
:
{
last_debian_dist
}
-buildpackage'
,
f
"
{
REGISTRY
}
:buildpackage"
)
def
build_image
(
image
:
CubicWebImage
,
onbuild
:
Optional
[
str
],
no_cache
=
False
,
registry
=
None
):
def
build_image
(
image
:
CubicWebImage
,
onbuild
:
Optional
[
str
],
no_cache
=
False
):
args
=
{}
dockerfile
=
'Dockerfile'
if
onbuild
is
not
None
:
...
...
@@ -169,38 +159,37 @@ def build_buildpackage(dist):
def
get_cubicweb_images
(
debian_dists
:
List
[
str
],
python_versions
:
List
[
str
]):
images
=
[]
for
dist
in
debian_dists
:
for
python_version
in
python_versions
:
python
=
'python'
if
python_version
==
'py27'
else
'python3'
check_call
(
'docker'
,
'build'
,
'.'
,
'-f'
,
'Dockerfile.getversion'
,
'-t'
,
'cubicweb:getversion'
,
'--build-arg'
,
f
'DIST=
{
dist
}
'
,
'--build-arg'
,
f
"PYTHON=
{
python
}
"
for
dist
,
python_version
in
product
(
debian_dists
,
python_versions
):
python
=
'python'
if
python_version
==
'py27'
else
'python3'
check_call
(
'docker'
,
'build'
,
'.'
,
'-f'
,
'Dockerfile.getversion'
,
'-t'
,
'cubicweb:getversion'
,
'--build-arg'
,
f
'DIST=
{
dist
}
'
,
'--build-arg'
,
f
"PYTHON=
{
python
}
"
)
versions
=
check_output
(
'docker'
,
'run'
,
'--rm'
,
'cubicweb:getversion'
).
splitlines
()
# filter release candidate version
valid_versions
=
[
version
for
version
in
versions
if
'~rc'
not
in
version
]
for
version
in
valid_versions
:
image
=
CubicWebImage
(
python
=
python_version
,
debian
=
dist
,
package_name
=
f
'
{
python
}
-cubicweb'
,
package_version
=
version
)
versions
=
check_output
(
'docker'
,
'run'
,
'--rm'
,
'cubicweb:getversion'
).
splitlines
()
# filter release candidate version
valid_versions
=
[
version
for
version
in
versions
if
'~rc'
not
in
version
]
for
version
in
valid_versions
:
image
=
CubicWebImage
(
python
=
python_version
,
debian
=
dist
,
package_name
=
f
'
{
python
}
-cubicweb'
,
package_version
=
version
)
images
.
append
(
image
)
images
.
append
(
image
)
return
images
def
build
(
debian_dists
:
List
[
str
],
images
:
List
[
CubicWebImage
]
=
[],
rebuild
=
False
):
...
...
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