forked from nahuic72/proyecto-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (55 loc) · 1.58 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
// comment
pipeline {
agent any
stages {
stage('Checkout-git'){
steps{
git poll: true, url: 'git@github.com:videocursoscloud/test-jenkins-1.git'
}
}
stage('CreateVirtualEnv') {
steps {
sh '''
bash -c "virtualenv entorno_virtual && source entorno_virtual/bin/activate"
'''
}
}
stage('InstallRequirements') {
steps {
sh '''
bash -c "source ${WORKSPACE}/entorno_virtual/bin/activate && ${WORKSPACE}/entorno_virtual/bin/python ${WORKSPACE}/entorno_virtual/bin/pip install -r requirements.txt"
'''
}
}
stage('TestApp') {
steps {
sh '''
bash -c "source ${WORKSPACE}/entorno_virtual/bin/activate && cd src && ${WORKSPACE}/entorno_virtual/bin/python ${WORKSPACE}/entorno_virtual/bin/pytest && cd .."
'''
}
}
stage('RunApp') {
steps {
sh '''
bash -c "source entorno_virtual/bin/activate ; ${WORKSPACE}/entorno_virtual/bin/python src/main.py &"
'''
}
}
stage('BuildDocker') {
steps {
sh '''
docker build -t apptest:latest .
'''
}
}
stage('PushDockerImage') {
steps {
sh '''
docker tag apptest:latest mijack/apptest:latest
docker push mijack/apptest:latest
docker rmi apptest:latest
'''
}
}
}
}