Commit 3ced4aa3 authored by Carine Dengler's avatar Carine Dengler
Browse files

chore: construct images for combinations of stretch/buster, py{27,35,37}

parent 16790850120e
ARG DIST ARG DIST
ARG PYTHON
FROM debian:$DIST-slim FROM debian:$DIST-slim
RUN apt-get update && \ RUN apt-get update && \
apt-get -y --no-install-recommends install \ apt-get -y --no-install-recommends install \
...@@ -10,4 +11,4 @@ RUN echo "deb http://apt.logilab.fr $DIST main" > /etc/apt/sources.list.d/logila ...@@ -10,4 +11,4 @@ RUN echo "deb http://apt.logilab.fr $DIST main" > /etc/apt/sources.list.d/logila
RUN wget -O - https://apt.logilab.fr/key.asc | apt-key --keyring /etc/apt/trusted.gpg.d/logilab.gpg add - RUN wget -O - https://apt.logilab.fr/key.asc | apt-key --keyring /etc/apt/trusted.gpg.d/logilab.gpg add -
CMD apt-get update > /dev/null && \ CMD apt-get update > /dev/null && \
apt-cache show python3-cubicweb | grep '^Version' | cut -f2 -d' ' apt-cache show "$PYTHON"-cubicweb | grep '^Version' | cut -f2 -d' '
...@@ -136,38 +136,40 @@ def build_buildpackage(dist): ...@@ -136,38 +136,40 @@ def build_buildpackage(dist):
'--build-arg', 'DIST={}'.format(dist), '--build-arg', 'DIST={}'.format(dist),
'-f', 'Dockerfile.buildpackage', '.') '-f', 'Dockerfile.buildpackage', '.')
def get_cubicweb_images(debian_dists: list[str]): def get_cubicweb_images(debian_dists: list[str], python_versions: list[str]):
images = [] images = []
for dist in debian_dists: for dist in debian_dists:
check_call( for python_version in python_versions:
'docker', python = 'python' if python_version == 'py27' else 'python3'
'build', check_call(
'.', 'docker',
'-f', 'build',
'Dockerfile.getversion', '.',
'-t', '-f',
'cubicweb:getversion', 'Dockerfile.getversion',
'--build-arg', '-t',
f'DIST={dist}' 'cubicweb:getversion',
) '--build-arg',
versions = check_output( f'DIST={dist}',
'docker', 'run', '--rm', 'cubicweb:getversion' '--build-arg',
).splitlines() f"PYTHON={python}"
# filter release candidate version
valid_versions = [
version for version in versions if '~rc' not in version
]
images = []
for version in valid_versions:
image = CubicWebImage(
python='py37',
debian=dist,
package_name='python3-cubicweb',
package_version=version
) )
images.append(image) 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)
return images return images
def build(debian_dists, images=[], rebuild=False): def build(debian_dists, images=[], rebuild=False):
...@@ -229,7 +231,9 @@ if __name__ == '__main__': ...@@ -229,7 +231,9 @@ if __name__ == '__main__':
help='push images') help='push images')
args = parser.parse_args() args = parser.parse_args()
REGISTRY = args.registry REGISTRY = args.registry
images = get_cubicweb_images(["stretch", "buster"]) images = get_cubicweb_images(["stretch", "buster"], ["py27"])
images += get_cubicweb_images(["stretch"], ["py35"])
images += get_cubicweb_images(["buster"], ["py37"])
if args.push: if args.push:
push() push()
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment