Skip to content

Instantly share code, notes, and snippets.

@NikitaMitroshin
Created September 25, 2018 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NikitaMitroshin/26f45425e2a134d49a16a20499c6cbe3 to your computer and use it in GitHub Desktop.
Save NikitaMitroshin/26f45425e2a134d49a16a20499c6cbe3 to your computer and use it in GitHub Desktop.
pipeline {
agent any
stages {
stage ('Compile & Test Stage') {
steps {
bat 'mvn clean compile'
bat 'mvn test'
}
}
stage ('Deployment To QA') {
steps {
bat 'mvn clean install -P !autoInstallPackagePublish'
}
}
stage('Create Jira ticket') {
steps {
script {
withEnv(['JIRA_SITE=Axamit']) {
def testIssue = [fields: [ // id or key must present for project.
project: [key: 'AAT'],
summary: 'New JIRA Created from Jenkins.',
description: 'New JIRA Created from Jenkins.',
// id or name must present for issueType.
customfield_10517: [value: 'Critical'],
issuetype: [name: 'Bug']]]
response = jiraNewIssue issue: testIssue
echo response.successful.toString()
echo response.data.toString()
}
}
}
}
stage("Continue Deployment?") {
agent none
steps {
timeout(time:5, unit:'DAYS') {
// you can use the commented line if u have specific user group who CAN ONLY approve
// input message: 'Deploy to Prod?', submitter: 'it-ops'
input message: 'Deploy to Prod?'
}
}
}
stage ('Merge Quality To Master') {
steps {
bat 'git checkout quality'
bat 'git pull'
bat 'git checkout master'
bat 'git pull'
bat 'git merge quality'
bat 'git push'
}
}
stage ('Deployment To PROD') {
steps {
bat 'git branch'
bat 'mvn clean install -P !autoInstallPackagePublish -Daem.port=8081'
}
}
}
post {
always {
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
to: 'nikitamitroshin@gmail.com',
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment