diff --git a/build-executor/image/Dockerfile b/build-executor/image/Dockerfile index f16539f3a07ba86b36af714f322141580ce5abf4..b0adc70d2c87b3c45228a4b44c71d28941c58d39 100644 --- a/build-executor/image/Dockerfile +++ b/build-executor/image/Dockerfile @@ -24,6 +24,7 @@ RUN yum install -y docker-ce \ ShellCheck \ http://ecsft.cern.ch/dist/cvmfs/cvmfs-2.6.0/cvmfs-shrinkwrap-2.6.0-1.el7.x86_64.rpm \ http://ecsft.cern.ch/dist/cvmfs/cvmfs-2.6.0/cvmfs-2.6.0-1.el7.x86_64.rpm \ + python-pip \ && yum clean all RUN sed -e 's@inet_interfaces = localhost@#inet_interfaces = localhost@' -e 's@inet_protocols = all@inet_protocols = ipv4@' -i /etc/postfix/main.cf @@ -36,6 +37,7 @@ RUN yum install -y singularity-runtime && yum clean all RUN sed -i -e 's/underlay = no/underlay = yes/g' /etc/singularity/singularity.conf RUN sed -i -e 's/overlay = try/overlay = no/g' /etc/singularity/singularity.conf +RUN pip install dictdiffer pyyaml # No ENTRYPOINT # See https://gitlab.com/gitlab-org/gitlab-runner/issues/2109 # See https://stackoverflow.com/a/33219131 diff --git a/common/json-differ.py b/common/json-differ.py new file mode 100755 index 0000000000000000000000000000000000000000..4905facc316faf3bb0e975864dd1e7770e0213f3 --- /dev/null +++ b/common/json-differ.py @@ -0,0 +1,21 @@ +#!/bin/python + +import sys +import json +from dictdiffer import diff + +json_a = json.load(open(sys.argv[1])) +json_b = json.load(open(sys.argv[2])) + +result = list(diff(json_a, json_b)) + +for entry in result: + if len(entry[2]) == 1: + print '\n\t %s :\n\t\t %s\t%s' % entry + else: + print '\n\t %s :\n\t\t %s\n\t\t\t%s\n\t\t\t%s' % (entry[0],entry[1],entry[2][0],entry[2][1]) + +exit(len(result)) + + + diff --git a/common/parsertest.sh b/common/parsertest.sh index 74748ff46405d4957e2397eec5f8c63caaf00cf0..121cba2540e780c9a9a6f04fc2695bbc7f912c79 100755 --- a/common/parsertest.sh +++ b/common/parsertest.sh @@ -1,5 +1,6 @@ #!/bin/bash +PARSERTEST_DIR=$(dirname $(readlink -f $0) ) # Input arguments function usage(){ echo "Usage: $0 [<workload-directory> (default: .)]" @@ -85,11 +86,12 @@ for job in $jobs; do testjson=${APPtest}${suffix} if [ -f ${testjson} ]; then echo -e "\n${testjson}:" - cat ${testjson} + python -c "import yaml; print yaml.dump( yaml.safe_load(open('${testjson}')))" if [ -f ${prodjson} ]; then if [ "$status2" == "" ]; then status2=0; fi echo -e "\nDIFFERENCES to ${prodjson}:" - diff ${testjson} ${prodjson} + $PARSERTEST_DIR/json-differ.py ${prodjson} ${testjson} + #diff ${testjson} ${prodjson} if [ $? -eq 0 ]; then echo "[None]" else