diff --git a/.jenkins.sh b/.jenkins.sh index 943fa9721a4253fb08ff27aede555021d508359f..3bad4e68f952186871fbe544cc7ac1c9422b8668 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 3c16489baa29719466eef09d77e9e51d9f5e5ed1..f5c825ad9b06585a6b1aff2191c5df9ef18a3f7b 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 e91f0fd857912c073b2257e62ea72df1d92efa3f..de313e6dbf5666f5428defa33027f68d14d9f926 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 0e0cbebfa4465fdfdb78c173bcdd645d667c034d..089cd2d8694ae7be69bb82fb5d9f36a26e5fe9c1 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 6d95c3574ee4ae94af92d114506dc56a7e3ecee7..ef8b7753101f957bcf04da2355333db8cab97529 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