[TESTAPI] Upgrade the docker without changing the python2.7 code 82/72282/1
authormorganrol <morgan.richomme@orange.com>
Sun, 28 Mar 2021 21:20:18 +0000 (23:20 +0200)
committermorganrol <morgan.richomme@orange.com>
Sun, 28 Mar 2021 21:20:18 +0000 (23:20 +0200)
migratio to python 3 is not a long flmeuve tranquille
some libraries used are no more maintained
this option considers updating the dockerfile without changing the
original code
it includes
- a change of the baseline image (move from 14.04 to 18.04)
- a better fix of python lib versions
- the introduction of an ubuntu user (to be better used)

Issue-ID: FUNCTEST-1026

Signed-off-by: morganrol <morgan.richomme@orange.com>
Change-Id: I37c8262d1ec20151e2402e298751ca39c36d1a7e

testapi/docker/Dockerfile
testapi/docker/prepare-env.sh
testapi/requirements.txt

index 9c8115f..4b88dfc 100644 (file)
 # http://www.apache.org/licenses/LICENSE-2.0
 #
 
-FROM ubuntu:14.04
+FROM ubuntu:18.04
 MAINTAINER SerenaFeng <feng.xiaowei@zte.com.cn>
 LABEL version="v1" description="OPNFV TestAPI Docker container"
 
 ENV HOME /home
 
+ARG user=ubuntu
+ARG group=ubuntu
+
 # Packaged dependencies
 RUN apt-get update && apt-get install -y \
 curl \
@@ -37,6 +40,7 @@ gcc \
 wget \
 python-dev \
 python-pip \
+python-setuptools \
 crudini \
 libxslt-dev \
 zlib1g-dev \
@@ -44,10 +48,14 @@ zlib1g-dev \
 
 RUN pip install --upgrade requests
 
+RUN groupadd -r $group && useradd -ms /bin/bash $user -g $group && \
+    mkdir -p /home/ubuntu/releng-testresults && \
+    chown -R $user:$group /home/ubuntu/releng-testresults
+
 RUN git config --global http.sslVerify false
-RUN git clone https://gerrit.opnfv.org/gerrit/releng-testresults /home/releng-testresults
 
-WORKDIR /home/releng-testresults/testapi
+RUN git clone https://gerrit.opnfv.org/gerrit/releng-testresults /home/ubuntu/releng-testresults
+WORKDIR /home/ubuntu/releng-testresults/testapi
 RUN pip install -r requirements.txt
 
 # bugfix
index a1b01bd..3b061d2 100755 (executable)
@@ -8,12 +8,12 @@ FILE=/etc/opnfv_testapi/config.ini
 
 auth_server=`echo ${auth:0:1} | tr '[:lower:]' '[:upper:]'``echo ${auth:1} | tr '[:upper:]' '[:lower:]'`
 auth_web=`echo ${auth} | tr '[:upper:]' '[:lower:]'`
-sudo crudini --set --existing ${FILE} mongo url ${mongodb_url}
-sudo crudini --set --existing ${FILE} api url ${base_url}/api/v1
-sudo crudini --set --existing ${FILE} ui url ${base_url}
-sudo crudini --set --existing ${FILE} api authenticate ${auth_server}
+crudini --set --existing ${FILE} mongo url ${mongodb_url}
+crudini --set --existing ${FILE} api url ${base_url}/api/v1
+crudini --set --existing ${FILE} ui url ${base_url}
+crudini --set --existing ${FILE} api authenticate ${auth_server}
 
-sudo cat > /usr/local/share/opnfv_testapi/testapi-ui/config.json << EOF
+cat > /usr/local/share/opnfv_testapi/testapi-ui/config.json << EOF
 {
   "testapiApiUrl": "${base_url}/api/v1",
   "authenticate": ${auth_web}
index f551d48..0223752 100644 (file)
@@ -2,12 +2,24 @@
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
 
-pbr>=2.0.0,!=2.1.0  # Apache-2.0
-setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2  # PSF/ZPL
-tornado>=3.1,<=4.3  # Apache-2.0
+pbr==4.0.4
+tornado==4.3 # Apache-2.0
 epydoc>=0.3.1
-six>=1.9.0  # MIT
+six==1.11.0  # MIT
 motor==1.2.2  # Apache-2.0
 python-cas==1.2.0
-requests[security]
-futures
\ No newline at end of file
+requests==2.19.1
+futures==3.2.0
+argparse==1.2.1
+backports-abc==0.5
+backports.ssl-match-hostname==3.5.0.1
+certifi==2018.4.16
+chardet==3.0.4
+colorama==0.2.5
+html5lib==0.999
+idna==2.7
+iniparse==0.4
+pymongo==3.6.1
+singledispatch==3.4.0.3
+urllib3==1.23
+wsgiref==0.1.2