-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
29 lines (28 loc) · 1.04 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
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'rm -rf build' // remove build folder
sh 'mkdir build' // create a new folder
sh 'touch build/car.txt' // create a empty file
sh 'echo "chassis" >> build/car.txt' // put chassis inside the file
sh 'echo "engine" >> build/car.txt' //put engine inside the file
sh 'echo "body" >> build/car.txt'
}
}
stage('Test'){
steps {
sh 'test -f build/car.txt' // test command combined with the -f flag allow us to test if a file exists
sh 'grep "chassis" build/car.txt' // grep command will enable us to search the content of a file for a specific string
sh 'grep "engine" build/car.txt'
sh 'grep "body" build/car.txt'
}
}
stage('Publish'){
steps {
archiveArtifacts artifacts: 'build/'
}
}
}
}