Loading .gitlab-ci.yml +48 Changes for .gitlab-ci.yml: 48 added lines, 0 removed lines. Original line number Diff line number Diff line # CI/CD: # * branch Continuously Builds & Push TOSCA parser image #image: docker:latest #services: # - docker:dind variables: GIT_DEPTH: "3" stages: - build - test build-tosca-toolbox: stage: build script: - echo "Building Cloudnet-TOSCA-toolbox image..." - ./scripts/build_tosca_parser.sh -v "Cloudnet-TOSCA-toolbox" - echo "Build finished" build-tosca-puccini: stage: build script: - echo "Building Puccini image..." - ./scripts/build_tosca_parser.sh -v "Puccini" - echo "Build finished" test-definitions-cloudnet: stage: test script: - echo "Parsing TOSCA definitions" - ./scripts/parse_tosca_definitions.sh -v "Cloudnet-TOSCA-toolbox" artifacts: when: always paths: - debugCloudnet.log test-definitions-puccini: stage: test script: - echo "Parsing TOSCA definitions" - ./scripts/parse_tosca_definitions.sh -v "Puccini" artifacts: when: always paths: - debugPuccini.log scripts/Dockerfile.puccini +14 Changes for scripts/Dockerfile.puccini: 14 added lines, 0 removed lines. Original line number Diff line number Diff line FROM ubuntu:16.04 #COPY requirements.txt /requirements.txt RUN apt-get update && apt-get install -y -qq curl git gcc RUN curl -OL https://golang.org/dl/go1.18.3.linux-amd64.tar.gz RUN tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz ENV PATH="${PATH}:/usr/local/go/bin" RUN git clone https://github.com/tliron/puccini.git /puccini RUN ./puccini/scripts/build ENV PATH="${PATH}:/root/go/bin" scripts/build_tosca_parser.sh +x+36 Changes for scripts/build_tosca_parser.sh: 36 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/bash TOSCA_PARSER="Cloudnet-TOSCA-toolbox" GIT_URL_TOSCA_TOOLBOX="https://github.com/Orange-OpenSource/Cloudnet-TOSCA-toolbox.git" TOSCA_PARSER_FOLDER="tosca-parser/" while getopts v: flag do case "${flag}" in v) TOSCA_PARSER=${OPTARG};; esac done if [ ${TOSCA_PARSER} == "Cloudnet-TOSCA-toolbox" ] ; then # clone robot tests git clone $GIT_URL_TOSCA_TOOLBOX $TOSCA_PARSER_FOLDER cd $TOSCA_PARSER_FOLDER docker build -t cloudnet/toscaware bin/toscaware #pwd #docker run -v "${PWD}:/work" -v "${PWD}/bin/cloudnet:/cloudnet" --workdir="/work" cloudnet/toscaware /bin/sh -c "echo Building image" #docker run --name=tosca-parser -v "${PWD}:/work" --workdir="/work" cloudnet/toscaware /bin/sh -c "ls" #sleep 5; #container_to_update=`docker ps -n 1 --format '{{.Names}}'` #echo "Creating updated image from container ${container_to_update}" #docker container commit ${container_to_update} cloudnet/toscaware:latest #echo "Deleting old container ${container_to_update}" #docker container rm ${container_to_update} elif [ ${TOSCA_PARSER} == "Puccini" ] ; then #Build Puccini docker from Dockerfile docker build -t puccini -f scripts/Dockerfile.puccini . fi exit scripts/parse_tosca_definitions.sh +x+79 Changes for scripts/parse_tosca_definitions.sh: 79 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/bash TOSCA_PARSER="Cloudnet-TOSCA-toolbox" GIT_URL_TOSCA_TOOLBOX="https://github.com/Orange-OpenSource/Cloudnet-TOSCA-toolbox.git" TOSCA_PARSER_FOLDER="tosca-parser/" while getopts v: flag do case "${flag}" in v) TOSCA_PARSER=${OPTARG};; esac done if [ ${TOSCA_PARSER} == "Cloudnet-TOSCA-toolbox" ] ; then # Parse TOSCA definitions echo "Cloudnet-TOSCA-toolbox: Validation starting ..." # Cloudnet-TOSCA-toolbox git clone $GIT_URL_TOSCA_TOOLBOX $TOSCA_PARSER_FOLDER mkdir ${TOSCA_PARSER_FOLDER}examples/sol001 cp *.yaml -t ${TOSCA_PARSER_FOLDER}examples/sol001 cd ${TOSCA_PARSER_FOLDER}examples/sol001 CLOUDNET_BINDIR=../../bin . ${CLOUDNET_BINDIR}/cloudnet_rc.sh finalResult=0 for i in *.yaml ; do result=0 echo "Cloudnet-TOSCA-toolbox: Validating file $i..." >> debugCloudnet.log ../../bin/toscaware/toscaware $i &> debug.log #docker ${DOCKER_OPTS} run --user "$(id -u)":"$(id -g)" -v "${PWD}/${TOSCA_PARSER_FOLDER}:/work" -v "${PWD}/${TOSCA_PARSER_FOLDER}/bin/cloudnet:/cloudnet" --workdir="/work" --rm --attach=stdin --attach=stdout --attach=stderr cloudnet/toscaware python ${PYTHON_OPTS} /cloudnet/tosca/tosca2cloudnet.py --template-file "$i" ${TOSCAWARE_OPTS} #docker ${DOCKER_OPTS} run --user "$(id -u)":"$(id -g)" --rm --attach=stdin --attach=stdout --attach=stderr cloudnet/toscaware python ${PYTHON_OPTS} /cloudnet/tosca/tosca2cloudnet.py --template-file "$1" ${TOSCAWARE_OPTS} #./${TOSCA_PARSER_FOLDER}/bin/toscaware/toscaware $i $> debug.log if [ $? == 2 ] ; then echo "Cloudnet-TOSCA-toolbox: ++++ Issues found with TOSCA file syntax in $i" grep "ERROR" < debug.log finalResult=1 else echo "Cloudnet-TOSCA-toolbox: ++++ TOSCA parser finished validation of $i" #Check the debug messages, if there's at least one ERROR then res=1 if [ `grep "ERROR" < debug.log | wc -l` == 0 ] ; then echo "++++ TOSCA parser finished validation of $i with no errors" else echo "Cloudnet-TOSCA-toolbox: ++++ TOSCA parser finished validation of $i with errors" grep "ERROR" < debug.log finalResult=1 fi fi cat debug.log >> debugCloudnet.log done cp debugCloudnet.log ../../../debugCloudnet.log elif [ ${TOSCA_PARSER} == "Puccini" ] ; then finalResult=0 echo "Puccini: Validation starting ..." docker run --rm -v "${PWD}:/sol001" puccini ./sol001/scripts/puccini_parse.sh &> debugPuccini.log if [ $? == 0 ] ; then echo "Puccini: ++++ TOSCA parser finished validation with no errors" elif [ $? == 1 ] ; then echo "Puccini: ++++ TOSCA parser finished validation with errors" #Check the debug messages, if there's at least one ERROR then res=1 #if [ `grep "PROBLEMS" < debug.log | wc -l` > 0 ] ; then # echo "Puccini: ++++ ERRORS: " # grep "PROBLEMS" < debug.log # res=1 #fi finalResult=1 fi fi exit $finalResult No newline at end of file scripts/puccini_parse.sh +x+15 Changes for scripts/puccini_parse.sh: 15 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/bash res=0 for i in /sol001/*.yaml ; do echo "Puccini: Validating file $i..." puccini-tosca parse $i if [ $? == 1 ] ; then res=1 fi done exit $res No newline at end of file Loading
.gitlab-ci.yml +48 Changes for .gitlab-ci.yml: 48 added lines, 0 removed lines. Original line number Diff line number Diff line # CI/CD: # * branch Continuously Builds & Push TOSCA parser image #image: docker:latest #services: # - docker:dind variables: GIT_DEPTH: "3" stages: - build - test build-tosca-toolbox: stage: build script: - echo "Building Cloudnet-TOSCA-toolbox image..." - ./scripts/build_tosca_parser.sh -v "Cloudnet-TOSCA-toolbox" - echo "Build finished" build-tosca-puccini: stage: build script: - echo "Building Puccini image..." - ./scripts/build_tosca_parser.sh -v "Puccini" - echo "Build finished" test-definitions-cloudnet: stage: test script: - echo "Parsing TOSCA definitions" - ./scripts/parse_tosca_definitions.sh -v "Cloudnet-TOSCA-toolbox" artifacts: when: always paths: - debugCloudnet.log test-definitions-puccini: stage: test script: - echo "Parsing TOSCA definitions" - ./scripts/parse_tosca_definitions.sh -v "Puccini" artifacts: when: always paths: - debugPuccini.log
scripts/Dockerfile.puccini +14 Changes for scripts/Dockerfile.puccini: 14 added lines, 0 removed lines. Original line number Diff line number Diff line FROM ubuntu:16.04 #COPY requirements.txt /requirements.txt RUN apt-get update && apt-get install -y -qq curl git gcc RUN curl -OL https://golang.org/dl/go1.18.3.linux-amd64.tar.gz RUN tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz ENV PATH="${PATH}:/usr/local/go/bin" RUN git clone https://github.com/tliron/puccini.git /puccini RUN ./puccini/scripts/build ENV PATH="${PATH}:/root/go/bin"
scripts/build_tosca_parser.sh +x+36 Changes for scripts/build_tosca_parser.sh: 36 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/bash TOSCA_PARSER="Cloudnet-TOSCA-toolbox" GIT_URL_TOSCA_TOOLBOX="https://github.com/Orange-OpenSource/Cloudnet-TOSCA-toolbox.git" TOSCA_PARSER_FOLDER="tosca-parser/" while getopts v: flag do case "${flag}" in v) TOSCA_PARSER=${OPTARG};; esac done if [ ${TOSCA_PARSER} == "Cloudnet-TOSCA-toolbox" ] ; then # clone robot tests git clone $GIT_URL_TOSCA_TOOLBOX $TOSCA_PARSER_FOLDER cd $TOSCA_PARSER_FOLDER docker build -t cloudnet/toscaware bin/toscaware #pwd #docker run -v "${PWD}:/work" -v "${PWD}/bin/cloudnet:/cloudnet" --workdir="/work" cloudnet/toscaware /bin/sh -c "echo Building image" #docker run --name=tosca-parser -v "${PWD}:/work" --workdir="/work" cloudnet/toscaware /bin/sh -c "ls" #sleep 5; #container_to_update=`docker ps -n 1 --format '{{.Names}}'` #echo "Creating updated image from container ${container_to_update}" #docker container commit ${container_to_update} cloudnet/toscaware:latest #echo "Deleting old container ${container_to_update}" #docker container rm ${container_to_update} elif [ ${TOSCA_PARSER} == "Puccini" ] ; then #Build Puccini docker from Dockerfile docker build -t puccini -f scripts/Dockerfile.puccini . fi exit
scripts/parse_tosca_definitions.sh +x+79 Changes for scripts/parse_tosca_definitions.sh: 79 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/bash TOSCA_PARSER="Cloudnet-TOSCA-toolbox" GIT_URL_TOSCA_TOOLBOX="https://github.com/Orange-OpenSource/Cloudnet-TOSCA-toolbox.git" TOSCA_PARSER_FOLDER="tosca-parser/" while getopts v: flag do case "${flag}" in v) TOSCA_PARSER=${OPTARG};; esac done if [ ${TOSCA_PARSER} == "Cloudnet-TOSCA-toolbox" ] ; then # Parse TOSCA definitions echo "Cloudnet-TOSCA-toolbox: Validation starting ..." # Cloudnet-TOSCA-toolbox git clone $GIT_URL_TOSCA_TOOLBOX $TOSCA_PARSER_FOLDER mkdir ${TOSCA_PARSER_FOLDER}examples/sol001 cp *.yaml -t ${TOSCA_PARSER_FOLDER}examples/sol001 cd ${TOSCA_PARSER_FOLDER}examples/sol001 CLOUDNET_BINDIR=../../bin . ${CLOUDNET_BINDIR}/cloudnet_rc.sh finalResult=0 for i in *.yaml ; do result=0 echo "Cloudnet-TOSCA-toolbox: Validating file $i..." >> debugCloudnet.log ../../bin/toscaware/toscaware $i &> debug.log #docker ${DOCKER_OPTS} run --user "$(id -u)":"$(id -g)" -v "${PWD}/${TOSCA_PARSER_FOLDER}:/work" -v "${PWD}/${TOSCA_PARSER_FOLDER}/bin/cloudnet:/cloudnet" --workdir="/work" --rm --attach=stdin --attach=stdout --attach=stderr cloudnet/toscaware python ${PYTHON_OPTS} /cloudnet/tosca/tosca2cloudnet.py --template-file "$i" ${TOSCAWARE_OPTS} #docker ${DOCKER_OPTS} run --user "$(id -u)":"$(id -g)" --rm --attach=stdin --attach=stdout --attach=stderr cloudnet/toscaware python ${PYTHON_OPTS} /cloudnet/tosca/tosca2cloudnet.py --template-file "$1" ${TOSCAWARE_OPTS} #./${TOSCA_PARSER_FOLDER}/bin/toscaware/toscaware $i $> debug.log if [ $? == 2 ] ; then echo "Cloudnet-TOSCA-toolbox: ++++ Issues found with TOSCA file syntax in $i" grep "ERROR" < debug.log finalResult=1 else echo "Cloudnet-TOSCA-toolbox: ++++ TOSCA parser finished validation of $i" #Check the debug messages, if there's at least one ERROR then res=1 if [ `grep "ERROR" < debug.log | wc -l` == 0 ] ; then echo "++++ TOSCA parser finished validation of $i with no errors" else echo "Cloudnet-TOSCA-toolbox: ++++ TOSCA parser finished validation of $i with errors" grep "ERROR" < debug.log finalResult=1 fi fi cat debug.log >> debugCloudnet.log done cp debugCloudnet.log ../../../debugCloudnet.log elif [ ${TOSCA_PARSER} == "Puccini" ] ; then finalResult=0 echo "Puccini: Validation starting ..." docker run --rm -v "${PWD}:/sol001" puccini ./sol001/scripts/puccini_parse.sh &> debugPuccini.log if [ $? == 0 ] ; then echo "Puccini: ++++ TOSCA parser finished validation with no errors" elif [ $? == 1 ] ; then echo "Puccini: ++++ TOSCA parser finished validation with errors" #Check the debug messages, if there's at least one ERROR then res=1 #if [ `grep "PROBLEMS" < debug.log | wc -l` > 0 ] ; then # echo "Puccini: ++++ ERRORS: " # grep "PROBLEMS" < debug.log # res=1 #fi finalResult=1 fi fi exit $finalResult No newline at end of file
scripts/puccini_parse.sh +x+15 Changes for scripts/puccini_parse.sh: 15 added lines, 0 removed lines. Original line number Diff line number Diff line #!/bin/bash res=0 for i in /sol001/*.yaml ; do echo "Puccini: Validating file $i..." puccini-tosca parse $i if [ $? == 1 ] ; then res=1 fi done exit $res No newline at end of file