Commit fc065178 authored by Marco Ortiz's avatar Marco Ortiz

Preparación para la integración con el nuevo jenkins

parent 33fab9ac
pipeline { pipeline {
agent any agent any
environment { environment {
include_docker = 'no'
IMAGE = readMavenPom().getArtifactId() IMAGE = readMavenPom().getArtifactId()
VERSION = readMavenPom().getVersion() VERSION = readMavenPom().getVersion()
...@@ -30,48 +32,48 @@ pipeline { ...@@ -30,48 +32,48 @@ pipeline {
} }
} }
} }
// stage('Test') { stage('Test') {
// steps { steps {
// withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') { withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
// sh 'mvn test' sh 'mvn test'
// } }
// } }
//
// post { post {
// always { always {
// junit 'target/surefire-reports/*.xml' junit 'target/surefire-reports/*.xml'
// } }
// } }
// } }
// stage('Code Quality Check via SonarQube') { stage('Code Quality Check via SonarQube') {
// steps { steps {
// withEnv(["JAVA_HOME=${tool 'jdk8'}", "PATH=${tool 'jdk8'}/bin:${env.PATH}"]) { withEnv(["JAVA_HOME=${tool 'jdk8'}", "PATH=${tool 'jdk8'}/bin:${env.PATH}"]) {
// withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') { withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
// sh 'mvn -DskipTests sonar:sonar \ sh 'mvn -DskipTests sonar:sonar \
// -Dsonar.projectKey=bytebot-service_$BRANCH_NAME \ -Dsonar.projectKey=bytebot-service_$BRANCH_NAME \
// -Dsonar.projectName=bytebot-service_$BRANCH_NAME \ -Dsonar.projectName=bytebot-service_$BRANCH_NAME \
// -Dsonar.sources=src/main/java/ \ -Dsonar.sources=src/main/java/ \
// -Dsonar.language=java \ -Dsonar.language=java \
// -Dsonar.java.binaries=target/classes \ -Dsonar.java.binaries=target/classes \
// -Dsonar.junit.reportsPath=target/surefire-reports \ -Dsonar.junit.reportsPath=target/surefire-reports \
// -Dsonar.jacoco.reportPaths=target/jacoco.exec \ -Dsonar.jacoco.reportPaths=target/jacoco.exec \
// -Dsonar.cobertura.reportPath=target/site/cobertura/coverage.xml \ -Dsonar.cobertura.reportPath=target/site/cobertura/coverage.xml \
// -Dsonar.clover.reportPath=target/clover.xml \ -Dsonar.clover.reportPath=target/clover.xml \
// -Dsonar.dynamicAnalysis=reuseReports \ -Dsonar.dynamicAnalysis=reuseReports \
// -Dsonar.java.coveragePlugin=plugin \ -Dsonar.java.coveragePlugin=plugin \
// -Dsonar.jacoco.reportMissing.force.zero=true \ -Dsonar.jacoco.reportMissing.force.zero=true \
// -Dsonar.host.url=http://byteswpe-sonar.tbs.com:9000 \ -Dsonar.host.url=http://byteswpe-sonar.tbs.com:9000 \
// -Dsonar.login=d09303420d51f36385b4613d29ee98978ca2ebe4' -Dsonar.login=d09303420d51f36385b4613d29ee98978ca2ebe4'
// }} }}
// } }
// } }
// stage('Deploy') { stage('Deploy') {
// steps { steps {
// withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') { withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
// sh 'mvn -DskipTests deploy' sh 'mvn -DskipTests deploy'
// } }
// } }
// } }
stage('Build Docker Image') { stage('Build Docker Image') {
steps { steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') { withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
...@@ -80,6 +82,9 @@ pipeline { ...@@ -80,6 +82,9 @@ pipeline {
} }
} }
stage('Deploy Image') { stage('Deploy Image') {
when {
expression { include_docker == 'yes' }
}
steps{ steps{
script { script {
docker.withRegistry(url, credentials ) { docker.withRegistry(url, credentials ) {
...@@ -91,6 +96,9 @@ pipeline { ...@@ -91,6 +96,9 @@ pipeline {
} }
} }
stage('Remove Unused docker image') { stage('Remove Unused docker image') {
when {
expression { include_docker == 'yes' }
}
steps { steps {
sh "docker rmi ${imagename}:latest" sh "docker rmi ${imagename}:latest"
sh "docker rmi ${imagename}:${VERSION}" sh "docker rmi ${imagename}:${VERSION}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment