Use Fedora 34, Fedora 35 and CentOS 8 as base container images

Change-Id: Ie3f7d75b390009e653842699dedb68a3b0d900a7
This commit is contained in:
Federico Ressi 2022-01-05 12:15:42 +01:00
parent 31758b2400
commit 544fe81e8a
3 changed files with 103 additions and 68 deletions

View File

@ -1,37 +1,43 @@
ARG base_image=python ARG base_image=py39
FROM centos:8 as lower-constraints
FROM python:3.10 as python
ENV INSTALL_PACKAGES="apt install -y"
ENV CONSTRAINS_FILE=upper-constraints.txt
RUN apt update && apt install -y iperf3 iputils-ping ncat
FROM python:3.8 as lower-constraints
ENV INSTALL_PACKAGES="apt install -y"
ENV CONSTRAINS_FILE=lower-constraints.txt ENV CONSTRAINS_FILE=lower-constraints.txt
ENV INSTALL_PACKAGES="dnf install -y"
ENV PYTHON_VERSION=3
RUN apt update && apt install -y iperf3 iputils-ping ncat USER 0
FROM fedora:35 as fedora FROM fedora:34 as py39
ENV CONSTRAINS_FILE=upper-constraints.txt ENV CONSTRAINS_FILE=upper-constraints.txt
ENV INSTALL_PACKAGES="dnf install -y" ENV INSTALL_PACKAGES="dnf install -y"
ENV PYTHON_VERSION=3.9
RUN ${INSTALL_PACKAGES} iperf3 gcc python3-devel USER 0
FROM fedora:35 as py310
ENV CONSTRAINS_FILE=upper-constraints.txt
ENV INSTALL_PACKAGES="dnf install -y"
ENV PYTHON_VERSION=3.10
USER 0
FROM ${base_image} as base FROM ${base_image} as base
ENV TOBIKO_DIR=/tobiko ENV TOBIKO_DIR=/tobiko
ENV WHEEL_DIR=/wheel ENV WHEEL_DIR=/wheel
ENV PACKAGES_DIR=/site_packages
ENV PYTHON=python${PYTHON_VERSION}
RUN python3 -m ensurepip --upgrade && \ RUN ${INSTALL_PACKAGES} ${PYTHON}
python3 -m pip install --upgrade setuptools wheel
RUN ${PYTHON} -m ensurepip --upgrade && \
${PYTHON} -m pip install --upgrade setuptools wheel pip
FROM base as source FROM base as source
@ -55,8 +61,11 @@ ADD .git ${TOBIKO_DIR}/.git/
FROM source as build FROM source as build
RUN ${INSTALL_PACKAGES} gcc ${PYTHON}-devel
# Build wheel files # Build wheel files
RUN python3 -m pip wheel -w ${WHEEL_DIR} \ RUN mkdir -p ${WHEEL_DIR}
RUN ${PYTHON} -m pip wheel --wheel-dir ${WHEEL_DIR} \
-c ${TOBIKO_DIR}/${CONSTRAINS_FILE} \ -c ${TOBIKO_DIR}/${CONSTRAINS_FILE} \
-r ${TOBIKO_DIR}/requirements.txt \ -r ${TOBIKO_DIR}/requirements.txt \
-r ${TOBIKO_DIR}/test-requirements.txt \ -r ${TOBIKO_DIR}/test-requirements.txt \
@ -69,10 +78,10 @@ FROM base as install
# Install wheels # Install wheels
RUN mkdir -p ${WHEEL_DIR} RUN mkdir -p ${WHEEL_DIR}
COPY --from=build ${WHEEL_DIR} ${WHEEL_DIR} COPY --from=build ${WHEEL_DIR} ${WHEEL_DIR}
RUN python3 -m pip install ${WHEEL_DIR}/*.whl RUN ${PYTHON} -m pip install --prefix /usr/local ${WHEEL_DIR}/*.whl
FROM source as tobiko FROM source as test
# Run tests variables # Run tests variables
ENV PYTHONWARNINGS=ignore::Warning ENV PYTHONWARNINGS=ignore::Warning
@ -81,6 +90,8 @@ ENV TOX_REPORT_DIR=/report
ENV TOX_REPORT_NAME=tobiko_results ENV TOX_REPORT_NAME=tobiko_results
ENV TOBIKO_PREVENT_CREATE=false ENV TOBIKO_PREVENT_CREATE=false
RUN ${INSTALL_PACKAGES} iperf3 iputils nmap-ncat findutils procps
# Write log files to report directory # Write log files to report directory
RUN mkdir -p /etc/tobiko RUN mkdir -p /etc/tobiko
RUN printf "[DEFAULT]\nlog_dir=${TOBIKO_REPORT_DIR}" > /etc/tobiko/tobiko.conf RUN printf "[DEFAULT]\nlog_dir=${TOBIKO_REPORT_DIR}" > /etc/tobiko/tobiko.conf
@ -95,7 +106,7 @@ WORKDIR ${TOBIKO_DIR}
CMD tools/run_tests.py ${OS_TEST_PATH} CMD tools/run_tests.py ${OS_TEST_PATH}
FROM tobiko as linters FROM test as linters
ENV SKIP=check-executables-have-shebangs,pylint ENV SKIP=check-executables-have-shebangs,pylint
@ -104,7 +115,11 @@ ADD .pre-commit-config.yaml \
linters-requirements.txt \ linters-requirements.txt \
${TOBIKO_DIR}/ ${TOBIKO_DIR}/
RUN python3 -m pip install -r ${TOBIKO_DIR}/linters-requirements.txt # Copy python pacakges
COPY --from=install /usr/local /usr/local/
# Install linters tools
RUN ${PYTHON} -m pip install -r ${TOBIKO_DIR}/linters-requirements.txt
RUN pre-commit install --install-hooks RUN pre-commit install --install-hooks
WORKDIR ${TOBIKO_DIR} WORKDIR ${TOBIKO_DIR}

View File

@ -2,14 +2,14 @@
version: '3.4' version: '3.4'
services: services:
unit: py3:
build: build:
context: . context: .
target: tobiko target: test
hostname: tobiko hostname: tobiko
environment: environment:
OS_TEST_PATH: tobiko/tests/unit OS_TEST_PATH: tobiko/tests/unit
TOX_REPORT_NAME: tobiko_results_unit TOX_REPORT_NAME: tobiko_results_py3
volumes: volumes:
- ./report:/report - ./report:/report
- .:/tobiko - .:/tobiko
@ -17,45 +17,54 @@ services:
lower-constraints: lower-constraints:
extends: extends:
service: unit service: py3
build: build:
context: .
target: tobiko
args: args:
base_image: lower-constraints base_image: lower-constraints
environment:
TOX_REPORT_NAME: tobiko_results_lower_constraints
py39:
extends:
service: py3
build:
args:
base_image: py39
environment:
TOX_REPORT_NAME: tobiko_results_py39
py310:
extends:
service: py3
build:
args:
base_image: py310
environment:
TOX_REPORT_NAME: tobiko_results_py310
linters: linters:
extends: extends:
service: unit service: py3
build: build:
target: linters target: linters
fedora:
extends:
service: unit
build:
context: .
target: tobiko
args:
base_image: fedora
functional: functional:
extends: extends:
service: unit service: py3
environment: environment:
OS_TEST_PATH: tobiko/tests/functional OS_TEST_PATH: tobiko/tests/functional
TOX_REPORT_NAME: tobiko_results_functional TOX_REPORT_NAME: tobiko_results_functional
create-workloads: create-workloads:
extends: extends:
service: unit service: py3
environment: environment:
OS_TEST_PATH: tobiko/tests/scenario OS_TEST_PATH: tobiko/tests/scenario
TOX_REPORT_NAME: tobiko_results_create_workloads TOX_REPORT_NAME: tobiko_results_create_workloads
disrupt-services: disrupt-services:
extends: extends:
service: unit service: py3
environment: environment:
OS_TEST_PATH: tobiko/tests/faults OS_TEST_PATH: tobiko/tests/faults
TOX_REPORT_NAME: tobiko_results_disrupt_services TOX_REPORT_NAME: tobiko_results_disrupt_services
@ -69,7 +78,7 @@ services:
verify-services: verify-services:
extends: extends:
service: unit service: py3
environment: environment:
OS_TEST_PATH: tobiko/tests/sanity OS_TEST_PATH: tobiko/tests/sanity
TOX_REPORT_NAME: tobiko_results_verify_services TOX_REPORT_NAME: tobiko_results_verify_services

View File

@ -6,12 +6,13 @@
Docker jobs intended to gate Tobiko container related changes Docker jobs intended to gate Tobiko container related changes
check: &CHECK check: &CHECK
jobs: jobs:
- tobiko-docker - tobiko-docker-lower-constraints
- tobiko-docker-fedora - tobiko-docker-py3
- tobiko-docker-py39
- tobiko-docker-py310
- tobiko-docker-functional - tobiko-docker-functional
- tobiko-docker-infrared - tobiko-docker-infrared
- tobiko-docker-linters - tobiko-docker-linters
- tobiko-docker-lower-constraints
gate: gate:
jobs: jobs:
- tobiko-docker-functional - tobiko-docker-functional
@ -21,7 +22,7 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- job: - job:
name: tobiko-docker name: tobiko-docker-py3
description: | description: |
Run unit tests for an OpenStack Python project inside a Docker container. Run unit tests for an OpenStack Python project inside a Docker container.
voting: true voting: true
@ -30,28 +31,49 @@
pre-run: playbooks/docker/pre.yaml pre-run: playbooks/docker/pre.yaml
run: playbooks/docker/run.yaml run: playbooks/docker/run.yaml
post-run: playbooks/docker/post.yaml post-run: playbooks/docker/post.yaml
# post-run: playbooks/docker/post.yaml
vars: vars:
docker_compose_service: unit docker_compose_service: py3
- job: - job:
name: tobiko-docker-fedora name: tobiko-docker-lower-constraints
description: | description: |
Run functional tests for an OpenStack Python project inside a Docker container Run functional tests for an OpenStack Python project inside a Docker container
based on Fedora 35 with lower-constraints.txt Pip constraints file.
voting: true voting: true
parent: tobiko-docker parent: tobiko-docker-py3
vars: vars:
docker_compose_service: fedora docker_compose_service: lower-constraints
- job:
name: tobiko-docker-py39
description: |
Run functional tests for an OpenStack Python project inside a Docker container
with Python 3.9
voting: true
parent: tobiko-docker-py3
vars:
docker_compose_service: py39
- job:
name: tobiko-docker-py310
description: |
Run functional tests for an OpenStack Python project inside a Docker container
with Python 3.10
voting: true
parent: tobiko-docker-py3
vars:
docker_compose_service: py310
- job: - job:
name: tobiko-docker-functional name: tobiko-docker-functional
description: | description: |
Run functional tests for an OpenStack Python project inside a Docker container. Run functional tests for an OpenStack Python project inside a Docker container
voting: true voting: true
parent: tobiko-docker parent: tobiko-docker-py3
timeout: 3600 timeout: 3600
vars: vars:
docker_compose_service: functional docker_compose_service: functional
@ -60,9 +82,9 @@
- job: - job:
name: tobiko-docker-infrared name: tobiko-docker-infrared
description: | description: |
Run functional tests for an OpenStack Python project inside a Docker container. Run Tobiko InfraRed plugin inside of a Docker container
voting: true voting: true
parent: tobiko-docker parent: tobiko-docker-py3
timeout: 3600 timeout: 3600
vars: vars:
docker_compose_service: infrared docker_compose_service: infrared
@ -73,17 +95,6 @@
description: | description: |
Run static analisys verifications Run static analisys verifications
voting: true voting: true
parent: tobiko-docker parent: tobiko-docker-py3
vars: vars:
docker_compose_service: linters docker_compose_service: linters
- job:
name: tobiko-docker-lower-constraints
description: |
Run functional tests for an OpenStack Python project inside a Docker container
with lower-constrains.txt requirements file.
voting: true
parent: tobiko-docker
vars:
docker_compose_service: lower-constraints