diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..6387026 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,44 @@ +pipeline { + agent any + + tools { + nodejs 'nodejs-latest' // Jenkins global tool name for Node.js + } + + environment { + SONARQUBE_SCANNER = tool 'sonarqube' // Jenkins global tool name for SonarQube Scanner + } + + stages { + stage('SonarQube Analysis') { + steps { + withSonarQubeEnv('sonarqubeserer') { + sh """ + ${SONARQUBE_SCANNER}/bin/sonar-scanner \\ + -Dsonar.projectKey=abap-tutorial-11 \\ + -Dsonar.projectName="abap-tutorial-11" \\ + -Dsonar.sources=src \\ + -Dsonar.tests=test,tests,__tests__ \\ + -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info \\ + -Dsonar.exclusions=node_modules/**,coverage/**,dist/**,build/** \\ + -Dsonar.testExecutionReportPaths=test-report.xml + """ + } + } + } + + stage('Quality Gate') { + steps { + timeout(time: 10, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } + } + } + } + + post { + always { + cleanWs() + } + } +} \ No newline at end of file