Commit 407010bb authored by carignani's avatar carignani
Browse files

fix #10

parent 29b2707a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -10,12 +10,18 @@ cd $1
echo "------ Content of the folder ------"
ls

echo "------ Checking for previous logs ------"
if [ -f "$LOGFILE" ] ; then
	echo "Found previous log. Removing it"
	rm "$LOGFILE"
fi

echo "------ Validating all YANG, JSON and XML files ------"
# If there are no YANG, JSON or XML files, then simply exit
ls | grep -q 'yang\|json\|xml\|xsd'
ls | grep -q 'yang'
found_data_models=$?
if [ ! $found_data_models ] ; then 
    echo "-- No YANG, JSON, XML or XSD files."
    echo "-- No YANG files."
    exit 0
fi

+12 −2
Original line number Diff line number Diff line
@@ -91,13 +91,18 @@ pipeline {
                    returnStdout: true,
                    script: "cd ./data-models && git log --format='%ae' HEAD^!"
                )}"""

                COMMIT_HASH = """${sh(
                    returnStdout: true,
                    script: "cd ./data-models && git log --format='%h' HEAD^!"
                )}"""
			}

            echo "Sending email to: ${RECIPIENT}"
            emailext to: "${RECIPIENT}",
                attachLog: true,
                attachmentsPattern: '**/*.log',
                subject: "[3GPP Forge] Validation succeeded: ${currentBuild.fullDisplayName}",
                subject: "[3GPP Forge] Validation succeeded: ${currentBuild.fullDisplayName}, commit ${COMMIT_HASH}",
                body: "Your contribution to 3GPP Forge was applied successfully and, " +
                    "after running the validation process for all the files in the repository, " +
                    "no critical errors were detected.\n" +
@@ -113,6 +118,11 @@ pipeline {
                    returnStdout: true,
                    script: "cd ./data-models && git log --format='%ae' HEAD^!"
                )}"""

                COMMIT_HASH = """${sh(
                    returnStdout: true,
                    script: "cd ./data-models && git log --format='%h' HEAD^!"
                )}"""
			}

			updateGitlabCommitStatus name: 'Validate OpenAPI', state: 'failed'
@@ -121,7 +131,7 @@ pipeline {
            emailext to: "${RECIPIENT}",
                attachLog: true,
                attachmentsPattern: '**/*.log',
                subject: "[3GPP Forge] Validation failed: ${currentBuild.fullDisplayName}",
                subject: "[3GPP Forge] Validation failed: ${currentBuild.fullDisplayName}, commit ${COMMIT_HASH}",
                body: "Your contribution to 3GPP Forge was applied successfully; however, " +
                    "after running the validation process for all the files in the repository, " +
                    "some errors were detected (they may, or may not be related to your own " +
+8 −2
Original line number Diff line number Diff line
@@ -5,6 +5,12 @@
LOGFILE=openapi-validation.log
DOCKER_IMAGE=etsiforge/swagger-cli:4.0.4

echo "------ Checking for previous logs ------"
if [ -f "$LOGFILE" ] ; then
    echo "Found previous log. Removing it"
    rm "$LOGFILE"
fi

if [ -x "$(command -v docker)" ] ; then
    RUN_IN_DOCKER=0
    echo "Using dockerized validator ($DOCKER_IMAGE)"
+8 −2
Original line number Diff line number Diff line
@@ -10,12 +10,18 @@ cd $1
echo "------ Content of the folder ------"
ls

echo "------ Checking for previous logs ------"
if [ -f "$LOGFILE" ] ; then
	echo "Found previous log. Removing it"
	rm "$LOGFILE"
fi

echo "------ Validating all YANG, JSON and XML files ------"
# If there are no YANG, JSON or XML files, then simply exit
ls | grep -q 'yang\|json\|xml\|xsd'
ls | grep -q 'yang'
found_data_models=$?
if [ ! $found_data_models ] ; then 
    echo "-- No YANG, JSON, XML or XSD files."
    echo "-- No YANG files."
    exit 0
fi