📚 Cheatsheet

Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.

Snippets 6

Retour
Build d'un projet Gradle
Facile
steps {
    sh './gradlew build'
}
Build d'un projet Maven
Facile
steps {
    sh 'mvn clean install'
}
Build et push d'une image Docker
Avancé
steps {
    script {
        def customImage = docker.build("my-image:${env.BUILD_ID}")
        customImage.push()
    }
}
Intégration SonarQube Scanner
Avancé
stage('Analyse SonarQube') {
    environment {
        scannerHome = tool 'SonarQubeScanner'
    }
    steps {
        withSonarQubeEnv('My SonarQube Server') {
            sh '${scannerHome}/bin/sonar-scanner'
        }
    }
}
Publier les résultats de tests JUnit
Intermédiaire
post {
    always {
        junit '**/target/surefire-reports/*.xml'
    }
}
Utiliser l'intégration Git
Facile
steps {
    git url: 'https://github.com/user/repo.git', branch: 'main'
}