Refactor image arch.
* Add entrypoint.sh
* Misc update for Dockerfile
* Move sources to cvp_checks and copy
it in image as is
Change-Id: Ib812793ac7f7de53313cef8a86a568a7a2c4849e
diff --git a/.gitignore b/.gitignore
index 303da24..61e0f6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,6 @@
# Ignore local virtualenvs
lib/
-bin/
include/
.Python/
diff --git a/Dockerfile b/Dockerfile
index 4879419..8b77628 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,22 +1,36 @@
FROM ubuntu:16.04
+LABEL maintainer="dev@mirantis.com"
+
+ENV DEBIAN_FRONTEND=noninteractive \
+ DEBCONF_NONINTERACTIVE_SEEN=true \
+ LANG=C.UTF-8 \
+ LANGUAGE=$LANG
+SHELL ["/bin/bash", "-xeo", "pipefail", "-c"]
+
USER root
+RUN mkdir -p /var/lib/cvp-sanity/
+COPY cvp-sanity/ /var/lib/cvp-sanity
WORKDIR /var/lib/
-RUN mkdir -p cvp-sanity/
-
-COPY . cvp-sanity/
-
-RUN apt-get update && \
- apt-get install -y python-pip git curl wget vim inetutils-ping libsasl2-dev python-dev libldap2-dev libssl-dev && \
- python -m pip install --upgrade pip && \
- pip install -r cvp-sanity/requirements.txt && \
- apt-get -y autoremove; apt-get -y clean
-
-RUN rm -rf /root/.cache && \
- rm -rf /var/lib/apt/lists/* && \
- rm -rf /tmp/* && \
- rm -rf /var/tmp/*
-
-ENTRYPOINT ["/bin/bash"]
+RUN pushd /etc/apt/ && echo > sources.list && \
+ echo 'Acquire::Languages "none";' > apt.conf.d/docker-no-languages && \
+ echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > apt.conf.d/docker-gzip-indexes && \
+ echo 'APT::Get::Install-Recommends "false"; APT::Get::Install-Suggests "false";' > apt.conf.d/docker-recommends && \
+ echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" >> sources.list && \
+ echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse" >> sources.list && \
+ echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse" >> sources.list && \
+ popd ; apt-get update && apt-get upgrade -y && \
+ apt-get install -y curl git-core iputils-ping libffi-dev libldap2-dev libsasl2-dev libssl-dev patch python-dev python-pip python3-dev vim-tiny wget \
+ python-virtualenv python3-virtualenv && \
+#Due to upstream bug we should use fixed version of pip
+ python -m pip install --upgrade 'pip==9.0.3' && \
+ pip install -r cvp-sanity/requirements.txt && \
+# Cleanup
+ apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6 ppp pppconfig pppoeconf popularity-contest cpp gcc g++ libssl-doc && \
+ apt-get -y autoremove; apt-get -y clean ; rm -rf /root/.cache; rm -rf /var/lib/apt/lists/* && \
+ rm -rf /tmp/* ; rm -rf /var/tmp/* ; rm -rfv /etc/apt/sources.list.d/* ; echo > /etc/apt/sources.list
+COPY bin /usr/local/bin/
+ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
+# docker build --no-cache -t cvp-sanity-checks:$(date "+%Y_%m_%d_%H_%M_%S") .
diff --git a/README.md b/README.md
index c2ae337..13acd7e 100644
--- a/README.md
+++ b/README.md
@@ -7,14 +7,14 @@
=======================
1) Clone repo to any node (node must have an access via http to salt master):
-```bash
+```bash
# root@cfg-01:~/# git clone https://github.com/Mirantis/cvp-sanity-checks
# cd cvp-sanity-checks
```
Use git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
if needed.
-2) Install virtualenv
+2) Install virtualenv
```bash
# curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-X.X.tar.gz
# tar xvfz virtualenv-X.X.tar.gz
@@ -22,11 +22,12 @@
# sudo python setup.py install
```
or
-```bash
+1```bash
# apt-get install python-virtualenv
```
3) Create virtualenv and install requirements and package:
+
```bash
# virtualenv --system-site-packages .venv
# source .venv/bin/activate
@@ -36,7 +37,7 @@
```
4) Configure:
-```bash
+```bash
# vim cvp_checks/global_config.yaml
```
SALT credentials are mandatory for tests.
@@ -55,10 +56,10 @@
```
5) Start tests:
-```bash
+```bash
# pytest --tb=short -sv cvp_checks/tests/
```
or
-```bash
+```bash
# pytest -sv cvp_checks/tests/ --ignore cvp_checks/tests/test_mtu.py
```
diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh
new file mode 100755
index 0000000..99cd175
--- /dev/null
+++ b/bin/entrypoint.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -xe
+
+function _info(){
+ set +x
+ echo -e "=== INFO: pip freeze:"
+ pip freeze | sort
+ echo -e "============================"
+ set -x
+}
+
+_info
+exec "$@"
diff --git a/Makefile b/cvp-sanity/Makefile
similarity index 100%
rename from Makefile
rename to cvp-sanity/Makefile
diff --git a/cvp_checks/__init__.py b/cvp-sanity/cvp_checks/__init__.py
similarity index 100%
rename from cvp_checks/__init__.py
rename to cvp-sanity/cvp_checks/__init__.py
diff --git a/cvp_checks/fixtures/__init__.py b/cvp-sanity/cvp_checks/fixtures/__init__.py
similarity index 100%
rename from cvp_checks/fixtures/__init__.py
rename to cvp-sanity/cvp_checks/fixtures/__init__.py
diff --git a/cvp_checks/fixtures/base.py b/cvp-sanity/cvp_checks/fixtures/base.py
similarity index 100%
rename from cvp_checks/fixtures/base.py
rename to cvp-sanity/cvp_checks/fixtures/base.py
diff --git a/cvp_checks/global_config.yaml b/cvp-sanity/cvp_checks/global_config.yaml
similarity index 100%
rename from cvp_checks/global_config.yaml
rename to cvp-sanity/cvp_checks/global_config.yaml
diff --git a/cvp_checks/tests/__init__.py b/cvp-sanity/cvp_checks/tests/__init__.py
similarity index 100%
rename from cvp_checks/tests/__init__.py
rename to cvp-sanity/cvp_checks/tests/__init__.py
diff --git a/cvp_checks/tests/ceph/test_ceph_haproxy.py b/cvp-sanity/cvp_checks/tests/ceph/test_ceph_haproxy.py
similarity index 100%
rename from cvp_checks/tests/ceph/test_ceph_haproxy.py
rename to cvp-sanity/cvp_checks/tests/ceph/test_ceph_haproxy.py
diff --git a/cvp_checks/tests/ceph/test_ceph_osd.py b/cvp-sanity/cvp_checks/tests/ceph/test_ceph_osd.py
similarity index 100%
rename from cvp_checks/tests/ceph/test_ceph_osd.py
rename to cvp-sanity/cvp_checks/tests/ceph/test_ceph_osd.py
diff --git a/cvp_checks/tests/ceph/test_ceph_pg_count.py b/cvp-sanity/cvp_checks/tests/ceph/test_ceph_pg_count.py
similarity index 100%
rename from cvp_checks/tests/ceph/test_ceph_pg_count.py
rename to cvp-sanity/cvp_checks/tests/ceph/test_ceph_pg_count.py
diff --git a/cvp_checks/tests/ceph/test_ceph_replicas.py b/cvp-sanity/cvp_checks/tests/ceph/test_ceph_replicas.py
similarity index 100%
rename from cvp_checks/tests/ceph/test_ceph_replicas.py
rename to cvp-sanity/cvp_checks/tests/ceph/test_ceph_replicas.py
diff --git a/cvp_checks/tests/ceph/test_ceph_tell_bench.py b/cvp-sanity/cvp_checks/tests/ceph/test_ceph_tell_bench.py
similarity index 100%
rename from cvp_checks/tests/ceph/test_ceph_tell_bench.py
rename to cvp-sanity/cvp_checks/tests/ceph/test_ceph_tell_bench.py
diff --git a/cvp_checks/tests/conftest.py b/cvp-sanity/cvp_checks/tests/conftest.py
similarity index 100%
rename from cvp_checks/tests/conftest.py
rename to cvp-sanity/cvp_checks/tests/conftest.py
diff --git a/cvp_checks/tests/test_cinder_services.py b/cvp-sanity/cvp_checks/tests/test_cinder_services.py
similarity index 100%
rename from cvp_checks/tests/test_cinder_services.py
rename to cvp-sanity/cvp_checks/tests/test_cinder_services.py
diff --git a/cvp_checks/tests/test_contrail.py b/cvp-sanity/cvp_checks/tests/test_contrail.py
similarity index 100%
rename from cvp_checks/tests/test_contrail.py
rename to cvp-sanity/cvp_checks/tests/test_contrail.py
diff --git a/cvp_checks/tests/test_default_gateway.py b/cvp-sanity/cvp_checks/tests/test_default_gateway.py
similarity index 100%
rename from cvp_checks/tests/test_default_gateway.py
rename to cvp-sanity/cvp_checks/tests/test_default_gateway.py
diff --git a/cvp_checks/tests/test_drivetrain.py b/cvp-sanity/cvp_checks/tests/test_drivetrain.py
similarity index 100%
rename from cvp_checks/tests/test_drivetrain.py
rename to cvp-sanity/cvp_checks/tests/test_drivetrain.py
diff --git a/cvp_checks/tests/test_etc_hosts.py b/cvp-sanity/cvp_checks/tests/test_etc_hosts.py
similarity index 100%
rename from cvp_checks/tests/test_etc_hosts.py
rename to cvp-sanity/cvp_checks/tests/test_etc_hosts.py
diff --git a/cvp_checks/tests/test_galera_cluster.py b/cvp-sanity/cvp_checks/tests/test_galera_cluster.py
similarity index 100%
rename from cvp_checks/tests/test_galera_cluster.py
rename to cvp-sanity/cvp_checks/tests/test_galera_cluster.py
diff --git a/cvp_checks/tests/test_k8s.py b/cvp-sanity/cvp_checks/tests/test_k8s.py
similarity index 100%
rename from cvp_checks/tests/test_k8s.py
rename to cvp-sanity/cvp_checks/tests/test_k8s.py
diff --git a/cvp_checks/tests/test_mtu.py b/cvp-sanity/cvp_checks/tests/test_mtu.py
similarity index 100%
rename from cvp_checks/tests/test_mtu.py
rename to cvp-sanity/cvp_checks/tests/test_mtu.py
diff --git a/cvp_checks/tests/test_nova_services.py b/cvp-sanity/cvp_checks/tests/test_nova_services.py
similarity index 100%
rename from cvp_checks/tests/test_nova_services.py
rename to cvp-sanity/cvp_checks/tests/test_nova_services.py
diff --git a/cvp_checks/tests/test_ntp_sync.py b/cvp-sanity/cvp_checks/tests/test_ntp_sync.py
similarity index 100%
rename from cvp_checks/tests/test_ntp_sync.py
rename to cvp-sanity/cvp_checks/tests/test_ntp_sync.py
diff --git a/cvp_checks/tests/test_oss.py b/cvp-sanity/cvp_checks/tests/test_oss.py
similarity index 100%
rename from cvp_checks/tests/test_oss.py
rename to cvp-sanity/cvp_checks/tests/test_oss.py
diff --git a/cvp_checks/tests/test_packet_checker.py b/cvp-sanity/cvp_checks/tests/test_packet_checker.py
similarity index 100%
rename from cvp_checks/tests/test_packet_checker.py
rename to cvp-sanity/cvp_checks/tests/test_packet_checker.py
diff --git a/cvp_checks/tests/test_rabbit_cluster.py b/cvp-sanity/cvp_checks/tests/test_rabbit_cluster.py
similarity index 100%
rename from cvp_checks/tests/test_rabbit_cluster.py
rename to cvp-sanity/cvp_checks/tests/test_rabbit_cluster.py
diff --git a/cvp_checks/tests/test_repo_list.py b/cvp-sanity/cvp_checks/tests/test_repo_list.py
similarity index 100%
rename from cvp_checks/tests/test_repo_list.py
rename to cvp-sanity/cvp_checks/tests/test_repo_list.py
diff --git a/cvp_checks/tests/test_salt_master.py b/cvp-sanity/cvp_checks/tests/test_salt_master.py
similarity index 100%
rename from cvp_checks/tests/test_salt_master.py
rename to cvp-sanity/cvp_checks/tests/test_salt_master.py
diff --git a/cvp_checks/tests/test_services.py b/cvp-sanity/cvp_checks/tests/test_services.py
similarity index 100%
rename from cvp_checks/tests/test_services.py
rename to cvp-sanity/cvp_checks/tests/test_services.py
diff --git a/cvp_checks/tests/test_single_vip.py b/cvp-sanity/cvp_checks/tests/test_single_vip.py
similarity index 100%
rename from cvp_checks/tests/test_single_vip.py
rename to cvp-sanity/cvp_checks/tests/test_single_vip.py
diff --git a/cvp_checks/tests/test_stacklight.py b/cvp-sanity/cvp_checks/tests/test_stacklight.py
similarity index 100%
rename from cvp_checks/tests/test_stacklight.py
rename to cvp-sanity/cvp_checks/tests/test_stacklight.py
diff --git a/cvp_checks/tests/test_ui_addresses.py b/cvp-sanity/cvp_checks/tests/test_ui_addresses.py
similarity index 100%
rename from cvp_checks/tests/test_ui_addresses.py
rename to cvp-sanity/cvp_checks/tests/test_ui_addresses.py
diff --git a/cvp_checks/utils/__init__.py b/cvp-sanity/cvp_checks/utils/__init__.py
similarity index 100%
rename from cvp_checks/utils/__init__.py
rename to cvp-sanity/cvp_checks/utils/__init__.py
diff --git a/requirements.txt b/cvp-sanity/requirements.txt
similarity index 100%
rename from requirements.txt
rename to cvp-sanity/requirements.txt
diff --git a/setup.py b/cvp-sanity/setup.py
similarity index 100%
rename from setup.py
rename to cvp-sanity/setup.py