diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..f113b59a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,19 @@ +node { +stage('SCM') +{ +checkout scm +} +stage('SonarQube Analysis') +{ +def scannerHome = tool 'sonarqubedemo'; +withSonarQubeEnv() +{ +bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=sonarqubedemo" +} +} + +stage("Build Result") +{ +echo "Build Successful" +} +} diff --git a/Jenkinsfile-1 b/Jenkinsfile-1 index 4edf935f..ecd950c5 100644 --- a/Jenkinsfile-1 +++ b/Jenkinsfile-1 @@ -1,15 +1,15 @@ pipeline { - agent { label 'linux' } + agent any options { buildDiscarder(logRotator(numToKeepStr: '5')) } stages { - stage('Scan') { + stage('Sonar Analysis') { steps { - withSonarQubeEnv(installationName: 'sq1') { - sh './mvnw clean org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar' + withSonarQubeEnv(installationName: 'sonarqubedemo') { + sh './mvnw clean install' } } } } -} \ No newline at end of file +} diff --git a/Jenkinsfile-2 b/Jenkinsfile-2 index cf293943..5166ae7d 100644 --- a/Jenkinsfile-2 +++ b/Jenkinsfile-2 @@ -1,22 +1,18 @@ -pipeline { - agent { label 'linux' } - options { - buildDiscarder(logRotator(numToKeepStr: '5')) - } - stages { - stage('Scan') { - steps { - withSonarQubeEnv(installationName: 'sq1') { - sh './mvnw clean org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar' - } - } - } - stage("Quality Gate") { - steps { - timeout(time: 2, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } - } - } - } -} \ No newline at end of file +node { +stage('SCM') +{ +checkout scm +} +stage('SonarQube Analysis') +{ +def scannerHome = tool 'sonarqubedemo'; +withSonarQubeEnv() +{ +bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=sonarqubedemo" +} +} +stage("Build Result") +{ +echo "Build Successful" +} +}