Commit d45dd326 authored by Elian Kraja's avatar Elian Kraja
Browse files

Fixing building scripts

parent 1027d2c0
#!/bin/bash
# Copyright ETSI 2019
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt
#set -e
set -vx
DOCKER_FILE=./scripts/docker/Dockerfile
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 -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
fi
# That's all Floks
exit 0
FROM ubuntu:16.04
MAINTAINER ETSI STF 583
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 \
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y \
&& DEBIAN_FRONTEND=noninteractive apt-get autoclean \
&& rm -rf /var/lib/apt/lists/*
RUN echo "docker-robot-STF583" > /etc/hostname \
&& echo "root:etsi" | chpasswd
RUN useradd --create-home --shell /bin/bash --user-group etsi --groups sudo \
&& echo "etsi:etsi" | chpasswd \
&& adduser etsi sudo \
&& echo "etsi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN DEBIAN_FRONTEND=noninteractive \
&& mkdir -p /home/etsi/dev/robot \
&& cd /home/etsi/dev/robot
#RUN pip3 install robotframework
ADD requirements.txt /home/etsi/dev/robot/
ADD extensions /home/etsi/dev/robot/extensions
RUN ls /home/etsi/dev/robot
RUN DEBIAN_FRONTED=noninteractive \
cd /home/etsi/dev/ \
mkdir -p build \
&& git clone https://forge.etsi.org/rep/forge-tools/robot2doc.git \
&& cd robot2doc \
&& pip3 install -r requirements.txt \
&& python3 -m pip install -e .
RUN DEBIAN_FRONTEND=noninteractive \
&& cd /home/etsi/dev/robot \
&& pip3 install -r requirements.txt
ADD . /home/etsi/dev/robot
RUN chmod +x /home/etsi/dev/robot/scripts/*
CMD tail -f /dev/null
#!/bin/bash
echo "Starting check on ROBOT CODE"
for FILE in $(find . -name "*.robot"); do
echo "Syntax check on ${FILE}"
robot --dryrun -d /tmp ${FILE}
done
#!/bin/bash
## Launch robot tests validator
mkdir logs
/bin/bash scripts/launch-validation.sh > logs/robot_stdout.log 2> logs/robot_stderr.log
## Filter failed Keywords
grep -r10n "| FAIL |" logs/robot_stdout.log | grep -v "Output:" | grep -v "Log:" | grep -v "Report:" > logs/failures.log
rm -f logs/robot_stdout.log
## Filter Errors on code
grep -rn " ERROR " logs/robot_stderr.log | grep -v "File has no tests or tasks" > logs/errors.log
rm -f logs/robot_stderr.log
ERRORS=`awk 'END{print NR}' logs/errors.log logs/failures.log`
if [ "${ERRORS}" -eq 0 ]; then
rm -f logs/errors.log
rm -f logs/failures.log
fi
if [ -f logs/errors.log ]; then
cat logs/errors.log
fi
if [ -f logs/failures.log ]; then
cat logs/failures.log
fi
if [ -f logs/erros.log ] || [ -f logs.failures.log ]; then
echo "Errors are found. Job failed"
exit 1
fi
#!/bin/bash
# Copyright ETSI 2019
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt
#set -e
#set -vx
mkdir -p build
docker run -v "$(pwd)/build:/home/etsi/dev/build" stf583-rf-validation:latest "bash" \
-c "/home/etsi/dev/robot/scripts/validate.sh"
ret=$?
exit $ret
......@@ -2,12 +2,26 @@
#
# 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
cd /home/etsi/dev/robot2doc/robot2doc
mkdir -p /home/etsi/dev/build
python3 create_sols.py ../../robot 'local' ../../build
res2=$?
exit $res && $res2
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment