Commit e917e4cb authored by Luca Verardo's avatar Luca Verardo
Browse files

Added MySQL container for SonarCloud tests

parent 8fb580bf
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -48,11 +48,19 @@ pipeline {
            steps{
                script{
                    withCredentials([usernamePassword(credentialsId: 'SonarCloud_Zegorax_Token', passwordVariable: 'SONARCLOUD_API_TOKEN', usernameVariable: 'SONARCLOUD_API_USER')]) {
                        docker.image('mysql').withRun('-e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=mentorarc -e MYSQL_USER=mentorarc -e MYSQL_PASSWORD=mentorarc') { c ->
                            docker.image('mysql').inside("--link ${c.id}:db") {
                                /* Wait until mysql service is up */
                                sh 'while ! mysqladmin ping -hdb --silent; do sleep 1; done'
                            }

                            docker.image('maven:3-alpine').inside() {
                                    checkout scm
                                    sh 'mv src/main/resources/application.properties.production src/main/resources/application.properties'
                                    sh 'mvn verify sonar:sonar'
                            }
                            
                        }
                    }
                }
            }