Commit 663bae58 authored by Carine Dengler's avatar Carine Dengler
Browse files

chore: add stretch to builds

parent 82660cbca12f
FROM debian:buster-slim
ARG DIST
FROM debian:$DIST-slim
RUN apt-get update && \
apt-get -y --no-install-recommends install \
wget \
gnupg \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN echo "deb http://apt.logilab.fr buster main" > /etc/apt/sources.list.d/logilab.list
RUN echo "deb http://apt.logilab.fr $DIST main" > /etc/apt/sources.list.d/logilab.list
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 && \
......
......@@ -136,50 +136,65 @@ def build_buildpackage(dist):
'--build-arg', 'DIST={}'.format(dist),
'-f', 'Dockerfile.buildpackage', '.')
def get_cubicweb_images():
check_call('docker', 'build', '.', '-f', 'Dockerfile.getversion', '-t','cubicweb:getversion')
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]
def get_cubicweb_images(debian_dists: list[str]):
images = []
for version in valid_versions:
image = CubicWebImage(
python='py37',
debian='buster',
package_name='python3-cubicweb',
package_version=version
for dist in debian_dists:
check_call(
'docker',
'build',
'.',
'-f',
'Dockerfile.getversion',
'-t',
'cubicweb:getversion',
'--build-arg',
f'DIST={dist}'
)
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
]
images = []
for version in valid_versions:
image = CubicWebImage(
python='py37',
debian=dist,
package_name='python3-cubicweb',
package_version=version
)
images.append(image)
return images
def build(images=[], rebuild=False):
if rebuild:
# pull base images
check_call('docker', 'pull', 'debian:stretch-slim')
check_call('docker', 'pull', 'debian:buster-slim')
# build_buildpackage('stretch')
build_buildpackage('buster')
def build(debian_dists, images=[], rebuild=False):
for dist in debian_dists:
if rebuild:
# pull base images
check_call('docker', 'pull', f'debian:{dist}-slim')
build_buildpackage(dist)
for image in images:
for image_type in (None, 'onbuild'):
build_image(image, image_type)
if rebuild and onbuild is None:
tag = _tag(python, dist, cw)
out = run(
'docker', 'run', '--rm', '-t',
'--user', 'root',
'--entrypoint', 'check-docker-updates.sh',
tag, 'apt')
if out.returncode == 1:
LOG.warning(red(
'%s debian packages updates are available: %s'),
tag, out.stdout)
build_image(python, dist, cw, onbuild, no_cache=True)
else:
assert (out.returncode, out.stdout) == (0, b''), out
LOG.info(green('%s debian packages are up-to-date'), tag)
if rebuild and image_type is None:
tag = image.tag
out = run(
'docker', 'run', '--rm', '-t',
'--user', 'root',
'--entrypoint', 'check-docker-updates.sh',
tag, 'apt')
if out.returncode == 1:
LOG.warning(red(
'%s debian packages updates are available: %s'),
tag, out.stdout)
build_image(image, image_type, no_cache=True)
else:
assert (out.returncode, out.stdout) == (0, b''), out
LOG.info(green('%s debian packages are up-to-date'), tag)
def push():
......@@ -214,7 +229,7 @@ if __name__ == '__main__':
help='push images')
args = parser.parse_args()
REGISTRY = args.registry
images = get_cubicweb_images()
images = get_cubicweb_images(["stretch", "buster"])
if args.push:
push()
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