-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipelinescript
46 lines (41 loc) · 1.48 KB
/
pipelinescript
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
pipeline {
agent any
stages {
stage('Checkout') {
steps {
// Checkout the code from GitHub
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/khaledgomaa/aspjenkinspipeline.git']])
}
}
stage('Build') {
steps {
dotnetBuild project: 'JenkinsPipeline.sln', sdk: 'dotnetsdk'
}
}
stage('Run Tests') {
steps {
dotnetTest sdk: 'dotnetsdk'
}
}
}
post{
success{
script{
def to = emailextrecipients([
[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']
])
// set variables
def subject = "${env.JOB_NAME} - Build #${env.BUILD_NUMBER} ${currentBuild.result}"
def content = '${JELLY_SCRIPT,template="html"}'
// send email
if(to != null && !to.isEmpty()) {
emailext(body: content, mimeType: 'text/html',
replyTo: '$DEFAULT_REPLYTO', subject: subject,
to: to, attachLog: true )
}
}
}
}
}