diff --git a/Jenkinsfile b/Jenkinsfile index a9c2a31958c3d0cd04b449dcea115dab926666b9..a060e7213cde7c00d36069bae2c8bd60fca88aca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,43 +1,24 @@ -pipeline { +node { + label 'docker' def customImage - agent { - node { - label 'docker' - } - } - options { - timeout(time: 1, unit: 'HOURS') - buildDiscarder( - logRotator( - numToKeepStr: '10', - artifactNumToKeepStr: '3' - ) - ) - ansiColor('xterm') + stage('Clone repository') { + checkout scm } - triggers { - cron('@weekly') + stage('Build Docker image') { + customImage = docker.build("demo-infra-jenkins-agent") } - stages { - stage('Clone repository') { - checkout scm - } - stage('Build Docker image') { - customImage = docker.build("demo-infra-jenkins-agent") + stage('Test Docker image') { + app.inside { + sh 'mvn' } - stage('Test Docker image') { - app.inside { - sh 'mvn' - } - } - stage('Push image') { - /* push image with two tags: - * - the incremental build number from Jenkins; - * - the 'latest' tag. */ - docker.withRegistry('https://www.joaolino.com/nexus/repository/docker-public/', 'nexus-admin') { - customImage.push("${env.BUILD_NUMBER}") - customImage.push("latest") - } + } + stage('Push image') { + /* push image with two tags: + * - the incremental build number from Jenkins; + * - the 'latest' tag. */ + docker.withRegistry('https://www.joaolino.com/nexus/repository/docker-public/', 'nexus-admin') { + customImage.push("${env.BUILD_NUMBER}") + customImage.push("latest") } } } \ No newline at end of file