From 4226ccd4651399d3b8b8d42ecb7e1b608ee8d676 Mon Sep 17 00:00:00 2001 From: Michele Carignani <michele.carignani@etsi.org> Date: Thu, 12 Nov 2020 22:11:32 +0100 Subject: [PATCH] bugfix --- .jenkins.sh | 4 +++- scripts/build-container.sh | 28 ++++++++++++++-------------- scripts/docker/Dockerfile | 11 +++++------ scripts/run-container.sh | 10 +++++----- scripts/validate.sh | 15 +++++++++++---- 5 files changed, 38 insertions(+), 30 deletions(-) diff --git a/.jenkins.sh b/.jenkins.sh index 943fa972..3bad4e68 100644 --- a/.jenkins.sh +++ b/.jenkins.sh @@ -12,4 +12,6 @@ run_dir="$(pwd)" bash ./scripts/build-container.sh bash ./scripts/run-container.sh "${run_dir}" -exit $? +ret=$? +echo "Final validation result: $ret" +exit $ret diff --git a/scripts/build-container.sh b/scripts/build-container.sh index 3c16489b..f5c825ad 100644 --- a/scripts/build-container.sh +++ b/scripts/build-container.sh @@ -10,25 +10,25 @@ if [ -f ${DOCKER_FILE} ] then #check and build stf583-rf-validation image DOCKER_ID=`docker ps -a | grep -e stf583-rf-validation | awk '{ print $1 }'` - if [ ! -z "${DOCKER_ID}" ] - then - docker rm --force stf583-rf-validation - fi - docker build --tag stf583-rf-validation --force-rm -f ${DOCKER_FILE} . +# if [ ! -z "${DOCKER_ID}" ] +# then +# docker rm --force stf583-rf-validation +# fi + docker build --tag stf583-rf-validation -f ${DOCKER_FILE} . if [ "$?" != "0" ] then echo "Docker build failed: $?" exit -1 fi - docker image ls -a - docker inspect stf583-rf-validation:latest - if [ "$?" != "0" ] - then - echo "Docker inspect failed: $?" - exit -2 - fi -else - exit -3 +# docker image ls -a +# docker inspect stf583-rf-validation:latest +# if [ "$?" != "0" ] +# then +# echo "Docker inspect failed: $?" +# exit -2 +# fi +#else +# exit -3 fi # That's all Floks diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile index e91f0fd8..de313e6d 100644 --- a/scripts/docker/Dockerfile +++ b/scripts/docker/Dockerfile @@ -7,11 +7,8 @@ LABEL description="SFT583 Robot Framework Docker Image" ENV TERM=xterm ENV HOSTNAME docker-robot-STF583 - ARG ssh_prv_key - - RUN DEBIAN_FRONTEND=noninteractive apt update \ && apt install python3 git -y \ && apt install python3-pip -y \ @@ -34,16 +31,18 @@ RUN DEBIAN_FRONTEND=noninteractive \ && mkdir -p /home/etsi/dev/robot \ && cd /home/etsi/dev/robot +RUN pip3 install robotframework + +RUN DEBIAN_FRONTEND=noninteractive \ + && cd /home/etsi/dev/robot \ + && git clone https://github.com/etsi-cti-admin/robotframework-mockserver ADD . /home/etsi/dev/robot -RUN pip3 install robotframework - RUN DEBIAN_FRONTEND=noninteractive \ && cd /home/etsi/dev/robot \ && pip3 install -r requirements.txt \ && chmod +x /home/etsi/dev/robot/scripts/* \ - && git clone https://github.com/etsi-cti-admin/robotframework-mockserver \ && cd robotframework-mockserver \ && patch -p1 < ../extensions/mockserverlibrary.patch \ && python3 -m pip install -e . diff --git a/scripts/run-container.sh b/scripts/run-container.sh index 0e0cbebf..089cd2d8 100644 --- a/scripts/run-container.sh +++ b/scripts/run-container.sh @@ -5,10 +5,10 @@ #set -e #set -vx -docker run stf583-rf-validation:latest "/bin/bash" \ - -c "cd /home/etsi/dev/robot \ - && bash scripts/validate.sh " +docker run stf583-rf-validation:latest "bash" \ + -c "/home/etsi/dev/robot/scripts/validate.sh" -# That's all Floks -exit $? +ret=$? + +exit $ret diff --git a/scripts/validate.sh b/scripts/validate.sh index 6d95c357..ef8b7753 100644 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -2,12 +2,19 @@ # # Validate syntax and keywords existance in each Robot file +cd /home/etsi/dev/robot/ + res=0 for i in */*/*.robot ; do - [[ "$i" != *"Keywords.robot"* && "$i" != *"Keyword.robot"* ]] && \ - (echo "++++ Dryrun $i" && \ - robot --dryrun --output NONE --report NONE --log NONE $i || \ - (echo "++++ Issues in file $i" && res=1)); + if [[ "$i" != *"Keywords.robot"* && "$i" != *"Keyword.robot"* ]] ; then + echo "++++ Dryrun file $i" + msg=$(robot --dryrun --output NONE --report NONE --log NONE $i 2>&1) + if [ $? != 0 ] ; then + echo "++++ Issues found in file $i" + echo "$msg" + res=1 + fi + fi done exit $res -- GitLab