-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
54 lines (50 loc) · 1.72 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
pipeline {
agent none
environment {
DOCKERHUB_CREDENTIALS=credentials('dockerhublogin')
}
stages {
stage('AMI_Agent') {
agent {
label 'jenkins-agent'
}
steps {
// Get some code from a GitHub repository
sh 'whoami'
sh 'pwd'
checkout([$class: 'GitSCM', branches: [[name: '*/bs']],
userRemoteConfigs: [[url: 'https://github.com/2206-devops-batch/BRT_Project2']]])
// Run pip install
sh "pip3 install -r ./requirements-dev.txt"
// Run pytest
// sh "python3 -m pytest test-app.py"
sh 'chmod +x ./dockerpush.sh'
sh 'ls -last'
// build new image if pytest passes.
sh '. ./dockerpush.sh'
}
}
// stage('Jenkins') {
// agent any
// environment {
// VERSION = sh(returnStdout:true,script:'git log -1 --pretty=format:"%H"').trim()
// }
// steps {
// sh 'whoami'
// sh 'pwd'
// sh 'which kubectl'
// sh ''
// // sh "kubectl set image 'deployment/flask-deployment' flaskimage=bryonsmith/flaskapp-demo:beb44ea4d9b16040fa774bfce0acf65fadd6e0dd"
// sh "kubectl set image 'deployment/flask-deployment' flaskimage=bryonsmith/flaskapp-demo:$VERSION"
// }
// }
}
post {
failure {
echo 'Pytest Failed!'
}
success {
echo "Success!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
}
}
}