Thursday, April 11, 2024

Jenkins Sonarqube Pipeline

      pipeline {
    agent any
    
    tools {
        maven 'maven3'
        jdk 'jdk11'
    }
    environment{
        SONAR_SCANNER_HOME= tool 'sonar-scanner'
    }

    stages {
        stage('Code Checkout') {
            steps {
                git changelog: false, poll: false, url: 'https://github.com/kishoraswar22/spring-boot-war-example.git'
            }
        }
        stage('Code Build') {
            steps {
                sh 'mvn compile'
            }
        }
        stage('Code Test') {
             
             tools{
                 jdk 'jdk17'
             }
           
                steps {
                withSonarQubeEnv('sonar') {
                   sh '''
                    $SONAR_SCANNER_HOME/bin/sonar-scanner  -Dsonar.projectName=SpringWebapp -Dsonar.projectKey=SpringWebapp \
                    -Dsonar.java.binaries=.
                    
                   
                    
                  '''
                   
               }
                    
               }
            }
        
     
            
        
        stage('Dev Deploy') {
            steps {
                deploy adapters: [tomcat9(credentialsId: 'tomcat_admin', path: '', url: 'http://43.204.32.171:8080')], contextPath: null, war: '**/*.war'
            }
        }
        
        
    }
}

      

No comments:

Post a Comment

Sample Game App Deployment on EKS cluster

 https://padmakshi.medium.com/setting-up-an-eks-cluster-and-deploying-a-game-application-a-step-by-step-guide-08790e0be117