-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile2
More file actions
53 lines (47 loc) · 2.21 KB
/
Jenkinsfile2
File metadata and controls
53 lines (47 loc) · 2.21 KB
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
49
50
51
52
53
pipeline {
agent {
// this image provides everything needed to run Cypress
docker {
image 'cypress/browsers:node12.4.0-chrome76'
args '-v /var/run/docker.sock:/var/run/docker.sock --security-opt label=disable -u root:sudo'
}
}
stages {
stage('build and run test') {
steps {
sh 'npm install --save-dev cypress'
//start tests execution
sh './node_modules/.bin/cypress run -s "cypress/integration/*" --env host="DevLab"'
}
post {
always {
junit 'results/cypress-report-*.xml'
//sh 'rm results/*'
}
success {
echo 'Build finished successfully'
}
failure {
emailext body: "<b>Project: ${env.JOB_NAME} </b><br>Build Number: ${env.BUILD_NUMBER} <br> URL of build: ${env.BUILD_URL}",
mimeType: 'text/html',
subject: "ERROR CI: Project name -> ${env.JOB_NAME}",
recipientProviders: [developers()]
}
unstable {
emailext body: "<b>Project: ${env.JOB_NAME} </b><br>Build Number: ${env.BUILD_NUMBER} <br> URL of build: ${env.BUILD_URL}",
mimeType: 'text/html',
subject: "Unstable Build: Project name -> ${env.JOB_NAME}",
recipientProviders: [developers()]
}
changed {
// This will run only if the state of the Pipeline has changed
//For example, if the Pipeline was previously failing but is now successful
emailext body: "<b>Project: ${env.JOB_NAME} </b><br>Build Number: ${env.BUILD_NUMBER} <br>URL of build: ${env.BUILD_URL} <br>Build result is: ${currentBuild.result}",
mimeType: 'text/html',
subject: "Build state has changed: Project name -> ${env.JOB_NAME}",
recipientProviders: [developers()]
}
}
}
}
}