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 comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio
Exit mobile version
%%footer%%