921d132a32
The current stdout file which also includes the dut logs are very verbose and noisy. We have manually installed it in the sonic-mgmt docker in our organization and tuned the pytest settings to produce very helpful and concise logs. pytest-html plugins can be used to post-process the output in various ways based on our different and unique organizational needs. Hence proposing to add this pkt to the docker file
172 lines
5.6 KiB
Django/Jinja
172 lines
5.6 KiB
Django/Jinja
FROM ubuntu:16.04
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y build-essential \
|
|
cmake \
|
|
curl \
|
|
default-jre \
|
|
gcc \
|
|
git \
|
|
inetutils-ping \
|
|
libffi-dev \
|
|
libssl-dev \
|
|
libxml2 \
|
|
libxslt1-dev \
|
|
make \
|
|
openssh-server \
|
|
psmisc \
|
|
python \
|
|
python-dev \
|
|
python-scapy \
|
|
python-setuptools \
|
|
rsyslog \
|
|
snmp \
|
|
sshpass \
|
|
sudo \
|
|
tcpdump \
|
|
telnet \
|
|
vim
|
|
|
|
RUN easy_install pip==20.1.1
|
|
|
|
RUN pip install cffi==1.10.0 \
|
|
"cryptography>=2.5" \
|
|
"future>=0.16.0" \
|
|
gitpython \
|
|
ipaddr \
|
|
ipython==5.4.1 \
|
|
ixnetwork-restpy==1.0.52 \
|
|
jinja2==2.7.2 \
|
|
jsonpatch \
|
|
lxml \
|
|
natsort \
|
|
netaddr \
|
|
netmiko==2.4.2 \
|
|
paramiko==2.7.1 \
|
|
passlib \
|
|
pexpect \
|
|
prettytable \
|
|
psutil \
|
|
pyasn1==0.1.9 \
|
|
pycryptodome \
|
|
pyfiglet \
|
|
pylint==1.8.1 \
|
|
pyro4 \
|
|
pysnmp==4.2.5 \
|
|
pytest-repeat \
|
|
pytest-html \
|
|
pytest-xdist==1.28.0 \
|
|
pytest==4.6.5 \
|
|
redis \
|
|
requests \
|
|
rpyc \
|
|
six \
|
|
tabulate \
|
|
textfsm \
|
|
virtualenv \
|
|
&& git clone https://github.com/p4lang/scapy-vxlan.git \
|
|
&& cd scapy-vxlan \
|
|
&& python setup.py install \
|
|
&& cd .. \
|
|
&& rm -fr scapy-vxlan \
|
|
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
|
|
&& tar xvfz 1.0.0.tar.gz \
|
|
&& cd nanomsg-1.0.0 \
|
|
&& mkdir -p build \
|
|
&& cd build \
|
|
&& cmake .. \
|
|
&& make install \
|
|
&& ldconfig \
|
|
&& cd ../.. \
|
|
&& rm -fr nanomsg-1.0.0 \
|
|
&& rm -f 1.0.0.tar.gz \
|
|
&& pip install nnpy \
|
|
&& pip install dpkt
|
|
|
|
# Install docker-ce-cli
|
|
RUN apt-get update \
|
|
&& apt-get install -y \
|
|
apt-transport-https \
|
|
ca-certificates \
|
|
curl \
|
|
gnupg-agent \
|
|
software-properties-common \
|
|
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
|
|
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
|
|
&& apt-get update \
|
|
&& apt-get install -y docker-ce-cli
|
|
|
|
# Install Microsoft Azure Kusto Library for Python
|
|
RUN pip install azure-kusto-data==0.0.13 \
|
|
azure-kusto-ingest==0.0.13
|
|
|
|
RUN pip install wheel==0.33.6
|
|
|
|
## Copy and install sonic-mgmt docker dependencies
|
|
COPY \
|
|
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
|
debs/{{ deb }}{{' '}}
|
|
{%- endfor -%}
|
|
debs/
|
|
|
|
RUN dpkg -i \
|
|
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
|
debs/{{ deb }}{{' '}}
|
|
{%- endfor %}
|
|
|
|
RUN pip install ansible==2.8.12
|
|
|
|
RUN pip install pysubnettree
|
|
|
|
# Install pytest-ansible module with 'become', 'become_user' parameters support
|
|
RUN git clone https://github.com/ansible/pytest-ansible.git \
|
|
&& cd pytest-ansible \
|
|
&& git checkout d33c025f070a9c870220a157cc5a999fda68de44 \
|
|
&& python setup.py install \
|
|
&& cd .. \
|
|
&& rm -fr pytest-ansible
|
|
|
|
RUN mkdir /var/run/sshd
|
|
EXPOSE 22
|
|
|
|
# Add user
|
|
ARG user
|
|
ARG uid
|
|
ARG guid
|
|
ARG hostname
|
|
|
|
ENV BUILD_HOSTNAME $hostname
|
|
ENV USER $user
|
|
ENV CC=gcc CPP=cpp CXX=c++ LDSHARED="gcc -pthread -shared" PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1
|
|
|
|
RUN groupadd -f -r -g $guid g$user
|
|
|
|
RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash
|
|
|
|
COPY sonic-jenkins.pub /var/$user/.ssh/authorized_keys2
|
|
|
|
RUN echo "Host *\n\tStrictHostKeyChecking no\n" > /var/$user/.ssh/config
|
|
RUN chown $user /var/$user/.ssh -R
|
|
RUN chmod go= /var/$user/.ssh -R
|
|
|
|
# Add user to sudoers
|
|
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
|
|
|
|
USER $user
|
|
|
|
# Install Azure CLI
|
|
WORKDIR /var/$user
|
|
RUN curl -L https://aka.ms/InstallAzureCliBundled -o azure-cli_bundle.tar.gz
|
|
RUN tar -xvzf azure-cli_bundle.tar.gz
|
|
RUN azure-cli_bundle_*/installer
|
|
|
|
# Known bug: azure keyvault cannot work behind a proxy
|
|
# Temporary fix: upgrade the azure-keyvault package within az cli
|
|
# TODO: if azure-cli contains newer version azure-keyvault, remove this
|
|
RUN ~/lib/azure-cli/bin/python -m pip install azure-keyvault==0.3.7 -U
|
|
|
|
# Install Virtual Environment
|
|
RUN python -m virtualenv --system-site-packages env-201811
|
|
RUN env-201811/bin/pip install ansible==2.0.0.2
|