This commit is contained in:
Oleksandr Butenko 2021-07-15 15:09:25 +03:00
commit 5ead3a3f5d

56
Jenkinsfile vendored
View file

@ -3,26 +3,19 @@ pipeline {
registry = "sprientera/pet" registry = "sprientera/pet"
registryCredential = 'dockerhub_id' registryCredential = 'dockerhub_id'
dockerImage = '' dockerImage = ''
RELEASE_NOTES = sh (script: """git log --format="medium" -1 ${GIT_COMMIT}""", returnStdout:true)
} }
// RELEASE_NOTES = sh (script: """git log --format="medium" -1 ${GIT_COMMIT}""", returnStdout:true)
// commit = sh (script: "git log -1 --pretty=%B", , returnStdout: true).trim()
agent any agent any
stages { stages {
stage('Jira2') { // stage('Jira2') {
steps { // steps {
jiraAddComment idOrKey: 'DEV-1', comment: 'hello', site: 'butenko992' // script {
// sh 'echo ${commit}'
script { // jiraAddComment idOrKey: "${commit}", comment: 'build successfull from commit', site: 'butenko992'
env.revision = sh(script: "git log --pretty=format:\"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\" \$prevcommit...\$GIT_COMMIT", , returnStdout: true).trim() // }
version = sh(script: "echo \$PARSED_TAG | awk -F\"_\" '{print \$1}'", , returnStdout: true).trim() //}
} //}
}
}
stage('get hash') {
steps {
sh 'echo ${RELEASE_NOTES}'
sh 'echo ${GIT_COMMIT}'
}
}
stage('Build') { stage('Build') {
steps { steps {
echo 'Running build automation' echo 'Running build automation'
@ -70,25 +63,24 @@ pipeline {
echo: 'caught error: $err' echo: 'caught error: $err'
} }
sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@${env.server_api} \"docker run --restart always --name pet -p 8081:8080 -d sprientera/pet:${env.BUILD_NUMBER}\"" sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@${env.server_api} \"docker run --restart always --name pet -p 8081:8080 -d sprientera/pet:${env.BUILD_NUMBER}\""
}
} }
} }
} }
stage('JIRA') { }
stage('get hash') {
steps { steps {
script { // sh 'echo ${GIT_COMMIT_MSG}'
def testIssue = [fields: [ // id or key must present for project. script {
project: [id: 'DEV'], commit = sh (script: "git log -1 --pretty=%B", , returnStdout: true).trim()
summary: 'New JIRA Created from Jenkins.', sh 'echo ${commit}'
description: 'New JIRA Created from Jenkins.', }
customfield_1000: 'customValue',
// id or name must present for issuetype.
issuetype: [id: '3']]]
response = jiraEditIssue idOrKey: 'DEV-1', issue: testIssue
echo response.successful.toString()
echo response.data.toString()
} }
} }
} }
post {
success {
echo 'I succeeded!'
jiraAddComment idOrKey: "${commit}", comment: 'build successfull from commit', site: 'butenko992'
}
} }
} }