-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
60 lines (60 loc) · 1.95 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
49
50
51
52
53
54
55
56
57
58
59
60
pipeline{
agent any
environment{
MY_FILE = fileExists 'HelloEndoWorld'
}
stages{
stage('Fetch and Compile: if repo do not exists'){
when { expression { MY_FILE == 'false' } }
steps {
echo "file does not exist"
sh 'git clone https://github.com/michelescarlato/HelloEndoWorld.git'
dir("HelloEndoWorld") {
sh 'pwd'
sh 'ls -lah'
sh 'make'
}
}
}
stage('Fetch and Compile:if repo exists'){
when { expression { MY_FILE == 'true' } }
steps {
echo "file exists"
dir("HelloEndoWorld") {
sh 'pwd'
sh 'ls -lah'
sh 'git fetch'
sh 'git reset --hard HEAD'
sh 'git merge "@{u}"'
sh 'make'
}
}
}
stage('run PATH flag test'){
steps{
dir("HelloEndoWorld"){
sh 'pytest tests/test_1a_path_flag.py'}
}
}
stage('run test on non-standard port'){
steps{
dir("HelloEndoWorld"){
sh 'pytest tests/test_2a_port_flag.py'}
}
}
stage('run test on endpoints'){
steps{
dir("HelloEndoWorld"){
sh 'pytest tests/test_3_endpoints.py'}
}
}
stage('run kubernetes job'){
steps{
dir("HelloEndoWorld"){
sh 'sudo kubectl apply -f helloendoworld-kubernetes-job.yaml && sleep 10'
sh 'curl 172.17.0.4:8080/helloworld && sleep 5'
sh 'sudo kubectl delete job helloendoworld-job && sleep 5'}
}
}
}
}