-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
28 lines (28 loc) · 915 Bytes
/
Copy pathJenkinsfile
File metadata and controls
28 lines (28 loc) · 915 Bytes
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
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'docker build -t localhost:5001/myapp:${BUILD_NUMBER} .'
}
}
stage('Test') {
steps {
sh 'docker run --rm localhost:5001/myapp:${BUILD_NUMBER} python -m pytest -v test_app.py'
}
}
stage('Push') {
steps {
sh 'docker push localhost:5001/myapp:${BUILD_NUMBER}'
}
}
stage('Deploy') {
steps {
// sh 'kubectl apply -f demodeploy.yaml'
// sh 'envsubst < demodeploy.yaml | kubectl apply -f -'
// sh 'sed "s/\${BUILD_NUMBER}/$BUILD_NUMBER/g" demodeploy.yaml | kubectl apply -f -'
sh('sed "s,\\${BUILD_NUMBER},' + env.BUILD_NUMBER + ',g" demodeploy.yaml | kubectl apply -f -')
}
}
}
}