Skip to content
Snippets Groups Projects
Jenkinsfile 1.79 KiB
pipeline {
    agent any
 
    tools {
        // Install the Maven version configured as "M3" and add it to the path.
        maven "MAVEN_HOME"
    }
 
    stages {
      /*  stage('Clone') {
            steps {
                timeout(time: 20, unit: 'MINUTES'){
                    git 'https://gitlab.com/pruebas48/codificacion.git'
                     }
            }
        }**/
        stage('Build') {
            steps {
                timeout(time: 20, unit: 'MINUTES'){
                  sh  "mvn -DskipTests clean package -e"
                  }
            }
        }
        stage('Test') {
            steps {
                timeout(time: 20, unit: 'MINUTES'){
                    // Se cambia <test> por <install> para que se genere el reporte de jacoco
                 sh "mvn clean install -DskipTests "
             //    sh "java -Dspring.profiles.active=prod -jar /var/lib/jenkins/workspace/codificacion/target/codificacion.jar"
                
                }
            }
        }
        stage('Sonar') {
            steps {
                timeout(time: 60, unit: 'MINUTES'){
                    withSonarQubeEnv('sonarqube'){
                      sh "mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar"
                    }
                }
            }
        }
stage('Quality gate') {
            steps {
 
                sleep(180) //seconds
 
                timeout(time: 60, unit: 'MINUTES'){
                    waitForQualityGate abortPipeline: true
                }
            }
        }
         stage('Despliege en un contenedor podman') {
            steps {
                
                //sh "cp Dockerfile target/Dockerfile"
              //sh 'podman-compose build . && 
              sh '  podman-compose up '   
            }
        }
       }
     }