diff --git a/jenkinsfile b/jenkinsfile new file mode 100644 index 000000000..ec190a48c --- /dev/null +++ b/jenkinsfile @@ -0,0 +1,53 @@ +pipeline { + agent any + + stages { + stage('Checkout') { + steps { + // Checkout code from Git repository + checkout scm + } + } + + stage('SonarQube Code Analysis') { + steps { + dir("${WORKSPACE}"){ + // Run SonarQube analysis for Angular + script { + def scannerHome = tool name: 'angular-demo', type: 'hudson.plugins.sonar.SonarRunnerInstallation' + withSonarQubeEnv('sonar') { + sh "echo $pwd" + sh "${scannerHome}/bin/sonar-scanner" + } + } + } + } + } + stage("SonarQube Quality Gate Check") { + steps { + script { + def qualityGate = waitForQualityGate() + + if (qualityGate.status != 'OK') { + echo "${qualityGate.status}" + error "Quality Gate failed: ${qualityGateStatus}" + } + else { + echo "${qualityGate.status}" + echo "SonarQube Quality Gates Passed" + } + } + } + } + stage('AWS Lambda'){ + steps { + invokeLambda([awsRegion: 'us-east-1', + functionName: '7ops_GetSonarqube_SendS3', + payload: "{ \"Suspend\": \"true\"}] }", + synchronous: true, + useInstanceCredentials: true]) + } + } + + } +} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..30e7fcfb2 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,10 @@ +# sample file +sonar.projectKey=angular-demo +sonar.projectName=angular-demo +sonar.sources=./ +# sonar.exclusions=**/*.css,**/*.html +sonar.typescript.tsconfigPaths=./**/tsconfig.json +# sonar.javascript.lcov.reportPaths=./analysis/coverage/lcov.info +# sonar.language=ts +# sonar.inclusions=**/*.ts +sonar.sourceEncoding=UTF-8