From 0ede74fd5a380f4f222781cc7668a061a5fcb7d6 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Tue, 20 Dec 2016 17:07:07 +0100 Subject: [PATCH] some jenkins changes --- Jenkinsfile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index de2085f..1b27354 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,11 @@ // Jenkinsfile (Pipeline Script) node { + // Configure environment + //env.JAVA_HOME = tool name: 'JDK8' + env.REPO_URL = "repo.koc.se/zallery.git" + env.BUILD_NAME = "BUILD-" + env.BUILD_ID + + checkout scm stage('Build') { @@ -7,24 +13,21 @@ node { sh 'ant build' } - //stage('Test') { - // try { - // sh 'ant test' - // } finally { - // step([$class: 'JUnitResultArchiver', testResults: 'build/reports/*.xml']) - // } - //} - - stage('Package') { - sh 'ant package' - archiveArtifacts artifacts: 'build/release/Zallery.war', fingerprint: true - } + sh 'ant package' + archiveArtifacts artifacts: 'build/release/*', fingerprint: true - - stage('Deploy') { - input message: 'Deploy?', submitter: 'ziver' - sh 'ant deploy' + // Tag artifact + withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491', + usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { + sh "git tag ${env.BUILD_NAME}" + sh "git push 'https://${USERNAME}:${PASSWORD}@${env.REPO_URL}' ${env.BUILD_NAME}" + } } } +stage('Deploy') { + input 'Deploy?', submitter 'Administrator' + sh 'ant deploy' +} +