Skip to content
Jenkinsfile 1.45 KiB
Newer Older
Luca Verardo's avatar
Luca Verardo committed
node {
    stage('Configure') {
        env.PATH = "${tool 'maven-3.3.9'}/bin:${env.PATH}"
        version = '1.0.' + env.BUILD_NUMBER
        currentBuild.displayName = version

        properties([
                buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')),
Luca Verardo's avatar
Luca Verardo committed
                [$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://http://github.com/zegorax/mentorarc/'],
Luca Verardo's avatar
Luca Verardo committed
                pipelineTriggers([[$class: 'GitHubPushTrigger']])
            ])
Zegorax's avatar
Zegorax committed
    }

Luca Verardo's avatar
Luca Verardo committed
    stage('Checkout') {
Luca Verardo's avatar
Luca Verardo committed
        git 'https://http://github.com/zegorax/mentorarc'
Luca Verardo's avatar
Luca Verardo committed
    }
Zegorax's avatar
Zegorax committed

Luca Verardo's avatar
Luca Verardo committed
    stage('Version') {
        sh "echo \'\ninfo.build.version=\'$version >> src/main/resources/application.properties || true"
        sh "mvn -B -V -U -e versions:set -DnewVersion=$version"
    }
Zegorax's avatar
Zegorax committed

Luca Verardo's avatar
Luca Verardo committed
    stage('Build') {
        sh 'mvn -B -V -U -e clean package'
Zegorax's avatar
Zegorax committed
    }
Luca Verardo's avatar
Luca Verardo committed

    stage('Archive') {
        junit allowEmptyResults: true, testResults: '**/target/**/TEST*.xml'
Zegorax's avatar
Zegorax committed
    }

Luca Verardo's avatar
Luca Verardo committed
    stage('Deploy') {
        // Depends on the 'Credentials Binding Plugin'
        // (https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin)
        withCredentials([[$class          : 'UsernamePasswordMultiBinding', credentialsId: 'cloudfoundry',
                          usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
            sh '''
                echo hello
Luca Verardo's avatar
Luca Verardo committed
                echo test
Luca Verardo's avatar
Luca Verardo committed
               '''
Zegorax's avatar
Zegorax committed
        }
    }
Luca Verardo's avatar
Luca Verardo committed
}