From 47cefb0bd89a4b1ff53e6e8549e0ac1285934899 Mon Sep 17 00:00:00 2001 From: Alex Zaharia Date: Tue, 26 Feb 2019 16:31:27 +0200 Subject: [PATCH] Changed the credential id in Jenkinsfile --- Jenkinsfile | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a652853d1..0e2bad8111 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,34 +1,40 @@ def now = new Date() def currentDate = now.format("yyyy-MM-dd", TimeZone.getTimeZone('UTC')) def changeLogs = params.changelog.replaceAll("\n","\\\\n").replaceAll("/",'\\\\/') -def zipFileName = "Build-"+params.buildVersion+".zip" +def zipFileName = "Build-"+params.buildVersion+"-RC.zip" env.BUILD_ZIP_PATH = params.brizySvnPath+"/"+zipFileName +if(params.gitMerge) { + zipFileName = "Build-"+params.buildVersion+".zip" +} + + def notifySlack(String buildResult = 'STARTED', String zipPath = '') { def buildInfo = "\nBranch: "+params.releaseBranch+"\nPlugin version: "+params.buildVersion+"\nEditor version: "+params.editorVersion+"\nChangelog\n"+params.changelog; - if ( buildResult == "SUCCESS" ) { - slackSend color: "good", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was successful."+buildInfo + withCredentials([string(credentialsId: 'Slack-Oauth-Token', variable: 'SECRET')]) { + if ( buildResult == "SUCCESS" ) { + slackSend tokenCredentialId: "$SECRET", color: "good", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was successful."+buildInfo - withCredentials([string(credentialsId: 'Slack Oauth Token', variable: 'SECRET')]) { sh ''' - set +x - curl -F file=@$BUILD_ZIP_PATH -F channels=#jenkins -F token="$SECRET" https://slack.com/api/files.upload + set +x + curl -F file=@$BUILD_ZIP_PATH -F channels=#jenkins -F token="$SECRET" https://slack.com/api/files.upload ''' - } - - } - else if( buildResult == "FAILURE" ) { - slackSend color: "danger", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was failed."+buildInfo - } - else if( buildResult == "UNSTABLE" ) { - slackSend color: "warning", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was unstable."+buildInfo - } - else { - slackSend color: "danger", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} its result was unclear."+buildInfo - } + + + } + else if( buildResult == "FAILURE" ) { + slackSend tokenCredentialId: "$SECRET", color: "danger", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was failed."+buildInfo + } + else if( buildResult == "UNSTABLE" ) { + slackSend tokenCredentialId: "$SECRET", color: "warning", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was unstable."+buildInfo + } + else { + slackSend tokenCredentialId: "$SECRET", color: "danger", message: "Job: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} its result was unclear."+buildInfo + } + } } def folderExist(path){ @@ -47,7 +53,7 @@ pipeline { } git url: "git@github.com:/ThemeFuse/Brizy", - credentialsId: '7ca32202-12d1-4189-9ff3-093095f8ffc3', + credentialsId: 'Git', branch: params.releaseBranch sh 'git config user.name "Alex Zaharia"'