Commit 7c8e8677 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Merge branch 'master' into 'master'

Artifcats exposure

See merge request !9
parents 86f842d3 6f33ecd9
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
# 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
+7 −2
Original line number Diff line number Diff line
@@ -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
+14 −8
Original line number Diff line number Diff line
@@ -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

+8 −2
Original line number Diff line number Diff line
@@ -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