Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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"
}
}
10 changes: 5 additions & 5 deletions Jenkinsfile-1
Original file line number Diff line number Diff line change
@@ -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'
}
}
}
}
}
}
40 changes: 18 additions & 22 deletions Jenkinsfile-2
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
}
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"
}
}