Newer
Older
sh 'mv src/main/resources/application.properties.production src/main/resources/application.properties'
docker.image('mysql').withRun('-e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=mentorarc -e MYSQL_USER=mentorarc -e MYSQL_PASSWORD=mentorarc') { c ->
sh 'while ! mysqladmin ping -hdb --silent; do sleep 1; done'
sh 'mv src/main/resources/application.properties.production src/main/resources/application.properties'
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("--link ${c.id}:db") {
checkout scm
sh 'mv src/main/resources/application.properties.production src/main/resources/application.properties'
sh 'mvn verify sonar:sonar'
}
}
stage('IntegrationTests') {
steps{
script {
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').withRun("--link ${c.id}") { d ->
checkout scm
sh 'mv src/main/resources/application.properties.production src/main/resources/application.properties'
sh 'nohup mvn exec:java &'
docker.image('lucienmoor/katalon-for-jenkins:latest').inside("--link ${d.id}:mentorarc") {
sh 'sleep 20'
sh 'curl mentorarc:8081'
}
// stage ('Performance') {
// octoPerfTest credentialsId: 'XXXXXX-XXX-XXX-XXXX', scenarioId: 'XXXXXXX'
// }
// stage ('JunitReport') {
// junit 'junit-report.xml'
// }
// stage ('PerfReport') {
// perfReport modeThroughput: true, sourceDataFiles: '**/*.jtl'
// }