forked from devops81/dbbackupscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
48 lines (43 loc) · 1.32 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pipeline {
agent any
parameters {
choice choices: ['NorthwindDB', 'DevOpsDB'], name: 'DBName'
}
stages {
stage('Choose DB') {
steps {
/* script {
properties([
parameters {
choice choices: ['NorthwindDB', 'DevOpsDB'], name: 'DBName' } ])
}*/
echo "The sanjeeb123933 dbname ${DBName}"
}
}
stage("DBBACKUP") {
steps {
powershell returnStatus: true, script: 'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\Pipelineascode\\Parameterized-DBBackup\\BackupDB.ps1'
}
}
stage('Email') {
steps {
script {
def mailRecipients = '[email protected]'
def jobName = currentBuild.fullDisplayName
emailext body: '''${SCRIPT, template="groovy-html"}''',
mimeType: 'text/html',
subject: "[Jenkins] ${jobName}",
to: "${mailRecipients}",
replyTo: "${mailRecipients}",
recipientProviders: [[$class: 'CulpritsRecipientProvider']]
}
}
}
}
post {
always {
/* junit 'examples/feed-combiner-java8-webapp/target/surefire-reports/*.xml'*/
emailext mimeType: 'text/html', replyTo: '[email protected]', subject: "${env.JOB_NAME} - Build# ${env.BUILD_NUMBER} - ${env.BUILD_STATUS}", to: '[email protected]', body:'${SCRIPT, template="groovy-html"}'
}
}
}