diff options
author | Peter Mikus <peter.mikus@protonmail.ch> | 2024-10-18 14:26:36 +0200 |
---|---|---|
committer | Peter Mikus <peter.mikus@protonmail.ch> | 2024-10-24 10:41:05 +0000 |
commit | 34a7bf412a78d8c2e259d631ec770047fe5b311d (patch) | |
tree | 55edb0c514676b4a302718aeac9c48846cfbea6f /fdio.infra.ansible/roles/docker_images | |
parent | 120716e561c1d0e3c7d06cbb96d1f70cf3949e5c (diff) |
feat(ansible): Ubuntu 24.04
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch>
Change-Id: Id486cbf0cdade79450912b54c068a3287c4edd36
Diffstat (limited to 'fdio.infra.ansible/roles/docker_images')
8 files changed, 192 insertions, 44 deletions
diff --git a/fdio.infra.ansible/roles/docker_images/files/base/Dockerfile b/fdio.infra.ansible/roles/docker_images/files/base/Dockerfile index 4514ec3679..f30caeb344 100644 --- a/fdio.infra.ansible/roles/docker_images/files/base/Dockerfile +++ b/fdio.infra.ansible/roles/docker_images/files/base/Dockerfile @@ -1,4 +1,6 @@ -FROM ubuntu:22.04 +# Import necessary base images +ARG BASE_IMAGE +FROM ${BASE_IMAGE} # Setup the environment ENV DEBIAN_FRONTEND=noninteractive @@ -56,6 +58,7 @@ RUN apt-get -q update \ python3-pip \ python3-pyelftools \ python3-setuptools \ + python3-venv \ python3-virtualenv \ qemu-system \ rdma-core \ @@ -72,10 +75,9 @@ RUN apt-get -q update \ tar \ tcpdump \ unzip \ - vim \ wget \ zlib1g-dev \ - && ln -s -f /usr/lib/x86_64-linux-gnu/libc.a /usr/lib/x86_64-linux-gnu/liblibc.a \ + #&& ln -s -f /usr/lib/x86_64-linux-gnu/libc.a /usr/lib/x86_64-linux-gnu/liblibc.a \ && curl -fsSL https://get.docker.com | sh \ && rm -rf /var/lib/apt/lists/* @@ -90,47 +92,58 @@ RUN mkdir -p /tmp/dumps \ && mkdir -p /var/log/vpp # CSIT PIP pre-cache -RUN pip3 install \ - ecdsa==0.18.0 \ - paramiko==3.3.1 \ - pycrypto==2.6.1 \ - python-dateutil==2.8.2 \ +RUN python3 -m venv venv \ + && venv/bin/pip3 install --upgrade --no-cache-dir pip \ + && venv/bin/pip3 install --upgrade setuptools \ + && venv/bin/pip3 install --upgrade wheel \ + && venv/bin/pip3 install \ + ecdsa==0.19.0 \ + paramiko==3.4.1 \ + pycryptodome==3.20.0 \ + python-dateutil==2.9.0 \ PyYAML==6.0.1 \ - requests==2.31.0 \ - robotframework==6.1.1 \ + requests==2.32.2 \ + robotframework==7.0.1 \ scapy==2.4.5 \ - scp==0.14.5 \ - ansible==8.2.0 \ - ansible-core==2.15.2 \ - dill==0.3.7 \ - numpy==1.25.2 \ - scipy==1.11.1 \ + scp==0.15.0 \ + ansible==10.2.0 \ + ansible-core==2.17.2 \ + dill==0.3.8 \ + numpy==2.0.1 \ + scipy==1.14.0 \ ply==3.11 \ - jsonschema==4.18.4 \ + jsonschema==4.23.0 \ rfc3339-validator==0.1.4 \ rfc3987==1.3.8 \ - attrs==23.1.0 \ - bcrypt==4.0.1 \ - certifi==2023.7.22 \ - cffi==1.15.1 \ - charset-normalizer==3.2.0 \ - cryptography==41.0.3 \ - idna==3.4 \ - Jinja2==3.1.2 \ - jsonschema-specifications==2023.7.1 \ - MarkupSafe==2.1.3 \ - packaging==23.1 \ - pycparser==2.21 \ + pylint==3.2.6 \ + astroid==3.2.4 \ + attrs==24.2.0 \ + bcrypt==4.2.0 \ + certifi==2024.7.4 \ + cffi==1.17.0 \ + charset-normalizer==3.3.2 \ + cryptography==43.0.0 \ + idna==3.7 \ + isort==5.13.2 \ + Jinja2==3.1.4 \ + jsonschema-specifications==2023.12.1 \ + MarkupSafe==2.1.5 \ + mccabe==0.7.0 \ + packaging==24.1 \ + platformdirs==4.2.2 \ + ply==3.11 \ + pycparser==2.22 \ PyNaCl==1.5.0 \ - referencing==0.30.0 \ + referencing==0.35.1 \ resolvelib==1.0.1 \ - rpds-py==0.9.2 \ + rpds-py==0.20.0 \ six==1.16.0 \ - urllib3==2.0.4 \ - meson==0.64.1 + tomli==2.0.1 \ + tomlkit==0.13.0 \ + typing_extensions==4.12.2 \ + urllib3==2.2.2 -RUN groupadd -g 1000 testuser \ - && useradd -rm -d /home/testuser -s /bin/bash -g testuser -G sudo -u 1000 testuser \ +RUN useradd -rm -d /home/testuser -s /bin/bash -g 1000 -G sudo testuser \ && echo 'testuser:Csit1234' | chpasswd RUN echo 'root:Csit1234' | chpasswd \ diff --git a/fdio.infra.ansible/roles/docker_images/files/csit-sut/Dockerfile b/fdio.infra.ansible/roles/docker_images/files/csit-sut/Dockerfile index 85537bc32f..69c8db39dc 100644 --- a/fdio.infra.ansible/roles/docker_images/files/csit-sut/Dockerfile +++ b/fdio.infra.ansible/roles/docker_images/files/csit-sut/Dockerfile @@ -1,4 +1,4 @@ -FROM base-ubuntu2204:local +FROM base-ubuntu2404:local EXPOSE 2222 diff --git a/fdio.infra.ansible/roles/docker_images/files/tg/Dockerfile b/fdio.infra.ansible/roles/docker_images/files/tg/Dockerfile new file mode 100644 index 0000000000..3ff0e2116d --- /dev/null +++ b/fdio.infra.ansible/roles/docker_images/files/tg/Dockerfile @@ -0,0 +1,103 @@ +# Import necessary base images +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +ARG TREX_VERSION +ARG IPERF_VERSION + +# Setup the environment +ENV DEBIAN_FRONTEND=noninteractive + +# Configure locales +RUN apt-get update -qq \ + && apt-get install -y \ + apt-utils \ + locales \ + && sed -i 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen \ + && locale-gen en_US.UTF-8 \ + && dpkg-reconfigure --frontend=noninteractive locales \ + && update-locale LANG=en_US.UTF-8 \ + && TZ=Etc/UTC && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ + && rm -r /var/lib/apt/lists/* +ENV LANG="en_US.UTF-8" LANGUAGE="en_US" LC_ALL="en_US.UTF-8" + +# Install packages and Docker +RUN apt-get -q update \ + && apt-get install -y -qq \ + apt-transport-https \ + bridge-utils \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + dkms \ + ethtool \ + gcc-9 \ + g++-9 \ + libibverbs-dev \ + libnuma1 \ + libnuma-dev \ + libpcap-dev \ + net-tools \ + openssh-server \ + pciutils \ + python3-all \ + python3-apt \ + python3-dev \ + python3-pip \ + python3-setuptools \ + python3-virtualenv \ + rdma-core \ + rsyslog \ + screen \ + socat \ + software-properties-common \ + strace \ + ssh \ + sshpass \ + sudo \ + tar \ + unzip \ + wget \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# Fix permissions +RUN chown root:syslog /var/log \ + && chmod 755 /etc/default + +# Create directory structure +RUN mkdir -p /var/run/sshd + +# Install AB +RUN apt-get -q update \ + && apt-get install -y -qq \ + apache2-utils \ + && rm -rf /var/lib/apt/lists/* + +# Install T-Rex +RUN wget -c https://github.com/cisco-system-traffic-generator/trex-core/archive/v${TREX_VERSION}.tar.gz -P /opt/ \ + && cd /opt/ \ + && tar xzfv v${TREX_VERSION}.tar.gz \ + && cd /opt/trex-core-${TREX_VERSION}/linux_dpdk/ \ + && ./b configure \ + && ./b build + +# Install iPerf +RUN wget -c https://downloads.es.net/pub/iperf/iperf-${IPERF_VERSION}.tar.gz -P /opt/ \ + && cd /opt/ \ + && tar xzfv iperf-${IPERF_VERSION}.tar.gz \ + && cd /opt/iperf-${IPERF_VERSION} \ + && ./configure \ + && make \ + && make install + +RUN groupadd -g 1000 testuser \ + && useradd -rm -d /home/testuser -s /bin/bash -g testuser -G sudo -u 1000 testuser \ + && echo 'testuser:Csit1234' | chpasswd + +RUN echo 'root:Csit1234' | chpasswd \ + && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \ + && echo "export VISIBLE=now" >> /etc/profile + +RUN service ssh start diff --git a/fdio.infra.ansible/roles/docker_images/tasks/base.yaml b/fdio.infra.ansible/roles/docker_images/tasks/base.yaml index 69b3f6217d..a3ded7466c 100644 --- a/fdio.infra.ansible/roles/docker_images/tasks/base.yaml +++ b/fdio.infra.ansible/roles/docker_images/tasks/base.yaml @@ -23,7 +23,7 @@ - docker-base - name: "Build CSIT Base Docker Image" - ansible.builtin.shell: "docker build -t base-ubuntu2204:local ." + ansible.builtin.shell: "docker build --build-arg BASE_IMAGE=ubuntu:24.04 -t base-ubuntu2404:local ." args: chdir: "/opt/csit-docker-images/base" async: 3000 @@ -43,7 +43,7 @@ - docker-base - name: "Build CSIT OLD Docker Image" - ansible.builtin.shell: "docker build -t csit_sut-ubuntu2204:local ." + ansible.builtin.shell: "docker build -t csit_sut-ubuntu2404:local ." args: chdir: "/opt/csit-docker-images/csit-sut" async: 3000 diff --git a/fdio.infra.ansible/roles/docker_images/tasks/main.yaml b/fdio.infra.ansible/roles/docker_images/tasks/main.yaml index 1005e024f2..382c70b80a 100644 --- a/fdio.infra.ansible/roles/docker_images/tasks/main.yaml +++ b/fdio.infra.ansible/roles/docker_images/tasks/main.yaml @@ -3,6 +3,8 @@ - name: "Build Base Docker Images" import_tasks: "base.yaml" + when: > + inventory_hostname in groups["sut"] tags: - docker-base diff --git a/fdio.infra.ansible/roles/docker_images/tasks/tg.yaml b/fdio.infra.ansible/roles/docker_images/tasks/tg.yaml index 0623616073..f4184d43d7 100644 --- a/fdio.infra.ansible/roles/docker_images/tasks/tg.yaml +++ b/fdio.infra.ansible/roles/docker_images/tasks/tg.yaml @@ -1,6 +1,26 @@ --- # file: tasks/tg.yaml +- name: "Create a Directory For Docker Images" + ansible.builtin.file: + path: "/opt/csit-docker-images/" + state: "directory" + mode: 0755 + tags: + - docker-base + +- name: "Copy Build Items" + ansible.builtin.copy: + src: "{{ item }}" + dest: "/opt/csit-docker-images/{{ item }}" + owner: "root" + group: "root" + mode: 0755 + with_items: + - "tg/" + tags: + - docker-base + - name: "Template Compose File" ansible.builtin.template: src: "{{ item }}.j2" diff --git a/fdio.infra.ansible/roles/docker_images/templates/docker-compose-sut.yaml.j2 b/fdio.infra.ansible/roles/docker_images/templates/docker-compose-sut.yaml.j2 index b4713d8552..810374527c 100644 --- a/fdio.infra.ansible/roles/docker_images/templates/docker-compose-sut.yaml.j2 +++ b/fdio.infra.ansible/roles/docker_images/templates/docker-compose-sut.yaml.j2 @@ -1,9 +1,10 @@ -version: "3" services: - numa-0: + sut-0: build: context: "base/" dockerfile: "Dockerfile" + args: + BASE_IMAGE: "ubuntu:24.04" cap_add: - NET_RAW command: ["/usr/sbin/sshd","-D", "-p", "6001"] @@ -20,10 +21,12 @@ services: source: "{{ volume.source }}" target: "{{ volume.target }}" {% endfor %} - numa-1: + sut-1: build: context: "base/" dockerfile: "Dockerfile" + args: + BASE_IMAGE: "ubuntu:24.04" cap_add: - NET_RAW command: ["/usr/sbin/sshd","-D", "-p", "6002"] diff --git a/fdio.infra.ansible/roles/docker_images/templates/docker-compose-tg.yaml.j2 b/fdio.infra.ansible/roles/docker_images/templates/docker-compose-tg.yaml.j2 index 2cee85e169..590ba76a38 100644 --- a/fdio.infra.ansible/roles/docker_images/templates/docker-compose-tg.yaml.j2 +++ b/fdio.infra.ansible/roles/docker_images/templates/docker-compose-tg.yaml.j2 @@ -1,9 +1,12 @@ -version: "3" services: tg-0: build: - context: "base/" + context: "tg/" dockerfile: "Dockerfile" + args: + BASE_IMAGE: "ubuntu:22.04" + TREX_VERSION: "3.03" + IPERF_VERSION: "3.7" command: ["/usr/sbin/sshd","-D", "-p", "6001"] expose: - "6001" @@ -20,8 +23,12 @@ services: {% endfor %} tg-1: build: - context: "base/" + context: "tg/" dockerfile: "Dockerfile" + args: + BASE_IMAGE: "ubuntu:22.04" + TREX_VERSION: "3.03" + IPERF_VERSION: "3.7" command: ["/usr/sbin/sshd","-D", "-p", "6002"] expose: - "6002" |