diff --git a/sa5/.gitlab-ci.yml b/sa5/.gitlab-ci.yml index 424b09bbd326ebce777f2b99100a71718ef3597b..f4fa27d9c2bde372225d93fab02458cdf202cb05 100644 --- a/sa5/.gitlab-ci.yml +++ b/sa5/.gitlab-ci.yml @@ -1,7 +1,5 @@ # CI/CD: # -# RESOLVE triggered by: -# - any (branch commit) # VALIDATION triggered by: # - any (branch commit) # @@ -25,7 +23,7 @@ stages: - validation - generation -YANG Strict: +YANG Validation Strict: stage: validation before_script: - | @@ -34,15 +32,16 @@ YANG Strict: script: - echo 'YANG Strict' - ./validate-data-models.sh . - after_script: - - ls artifacts: - name: "YANG strict validation result" + name: "YANG validation strict result" + when: always paths: - - ${LOGFILE_YANG} + - yang-validation.log + expose_as: 'YANG validation strict result' -YANG 3GPP Checks: +YANG Additional 3GPP Checks: stage: validation + allow_failure: true before_script: - | curl "${CI_API_V4_URL}/projects/57/repository/files/sa5%2Flint-data-models%2Esh/raw?ref=master" >> lint-data-models.sh @@ -51,9 +50,11 @@ YANG 3GPP Checks: - echo 'YANG 3GPP Checks' - ./lint-data-models.sh . artifacts: - name: "YANG 3gpp style check result" + name: "YANG Additional 3GPP checks result" + when: always paths: - - ${LOGFILE_LINT} + - yang-linting.log + expose_as: 'YANG Additional 3GPP checks result' Validate OpenAPI: stage: validation @@ -66,8 +67,10 @@ Validate OpenAPI: - ./validate-all.sh ./OpenAPI artifacts: name: "OpenAPI validation result" + when: always paths: - - ./OpenAPI/${LOGFILE_OPENAPI} + - OpenAPI/openapi-validation.log + expose_as: 'OpenAPI validation result' Word CR text: stage: generation diff --git a/sa5/lint-data-models.sh b/sa5/lint-data-models.sh index b9d8b4ff79f8135ebc31bd7c796ded5989aff36f..28fb0d191622f85b352bd7819c3d031630b90250 100755 --- a/sa5/lint-data-models.sh +++ b/sa5/lint-data-models.sh @@ -73,9 +73,14 @@ echo $ret if [ $ret == 1 ] ; then echo "Some issues were collected by the linter, but they are treated as warnings and are not failing the validation." +fi + +if [ ! -s $LOGFILE ] ;then + rm "$LOGFILE" +else echo "To see the full output of the linter, download the archived artifact named '$LOGFILE'." fi -# exit $ret -exit 0 +exit $ret +#exit 0 diff --git a/sa5/validate-all.sh b/sa5/validate-all.sh index 4c35f43d90dada91cdbffb995a7ea020d12050be..a79e5c4a241128c72ad8074375634a24da3b4d55 100755 --- a/sa5/validate-all.sh +++ b/sa5/validate-all.sh @@ -64,21 +64,27 @@ done echo -e "\n-- Final validator returns $fres." | tee -a $LOGFILE if [ $fres == 0 ] ; then - echo "No errors found, all files validate the OpenAPI definition. Below the complete log." | tee -a $LOGFILE + echo "No errors found, all files validate the OpenAPI definition" | tee -a $LOGFILE else - echo "Some errors found, see below the details." | tee -a $LOGFILE + echo "Some errors found by the OpenAPI validation" | tee -a $LOGFILE fi if [ ! "$ERR" == "" ] ; then - echo -e "\n---- Errors detected ----" | tee -a $LOGFILE - echo -e $ERR | tee -a $LOGFILE + echo -e "\n---- Errors detected ----" >> $LOGFILE + echo -e $ERR >> $LOGFILE fi -echo -e "\n---- Complete log of validation ----" | tee -a $LOGFILE -echo -e $LOG | tee -a $LOGFILE +echo -e "\n---- Complete log of validation ----" >> $LOGFILE +echo -e $LOG >> $LOGFILE -echo -e "\n------ Content of the folder ------" | tee -a $LOGFILE -ls | tee -a $LOGFILE +echo -e "\n------ Content of the folder ------" >> $LOGFILE +ls >> $LOGFILE + +if [ ! -s $LOGFILE ] ;then + rm "$LOGFILE" +else + echo "To see the full output of the OpenAPI validation, download the archived artifact named '$LOGFILE'." +fi # Exit code needed for jenkins to know the verdict of the build diff --git a/sa5/validate-data-models.sh b/sa5/validate-data-models.sh index eca92e3c28e5fe6b99c6d53f2c7784e74ea2ffbd..ba6cafb1bf36d6fdcfceb0d905aca6e628b3ad46 100755 --- a/sa5/validate-data-models.sh +++ b/sa5/validate-data-models.sh @@ -31,10 +31,16 @@ docker pull -q "${DOCKER_IMG}" docker run --rm -v $(pwd)/yang-models:/yang "${DOCKER_IMG}" "/bin/sh" -c 'pyang --strict -p external-yams *.yang' 2>>$LOGFILE >>$LOGFILE ret=$? -cat $LOGFILE - if [ $ret == 0 ] ; then echo "No errors found by pyang --strict validation." +else + echo "Some issues were collected by pyang --strict validation." +fi + +if [ ! -s $LOGFILE ] ;then + rm "$LOGFILE" +else + echo "To see the full output of the validation, download the archived artifact named '$LOGFILE'." fi exit $ret