DevOps Classroom Notes – 13/april/2024

Sonarqube analysis for .net project

pipeline {
    agent any
    stages {
        stage('vcs') {
            steps {
                git branch: 'main',
                    url: 'https://github.com/dummyrepos/SampleWeb.git'
            }
        }
        stage('build and analysis') {
            steps {
                withSonarQubeEnv(credentialsId: 'SONAR_CLOUD', installationName: 'sonarcloud') {
                    sh 'dotnet sonarscanner begin /k:"april24_sampleweb" /o:april24'
                    sh 'dotnet build SampleMVC.sln --no-incremental'
                    sh 'dotnet test SampleMVC.sln'
                    sh 'dotnet publish -c Release StudentsWeb/StudentsWeb.csproj -o published/'
                    sh 'dotnet sonarscanner end'
                    
                }
                
            }
        }
        stage("Quality Gate") {
            steps {
                timeout(time: 1, unit: 'HOURS') {
                    // Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails
                    // true = set pipeline to UNSTABLE, false = don't
                    waitForQualityGate abortPipeline: true
                }
            }
        }
        
    }
}

Package Repository or artifactory

  • To store build artifacts with versioning and history we need pacakge repositories

  • There are many tools available for doing this

    • Jfrog
    • Nexus
    • Azure Artifacts
    • Google artifactory
  • We will be using Jfrog Refer Here

  • To connect Jenkins with Jfrog Refer Here

  • Refer Here for pipeline samples in almost all languages

  • Refer Here for setting up the pipeline to publish to jfrog.

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube