-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
76 lines (65 loc) · 2.03 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
pipeline{
agent {
docker {
image 'python'
}
}
options { skipDefaultCheckout() }
environment {
HOME = "${env.WORKSPACE}"
}
parameters {
string(name: 'TAG', defaultValue: '', description: 'Version')
choice(name: 'CHOICES', choices: ['calidad', 'estructuras', 'estructura_con_notas', 'impacto_prioridad', 'linaje', 'administracion'],
description: 'Select collection to deploy')
string(name: 'ids', defaultValue: 'all', description: 'IDs (separated by , without spaces -> 1,2,3)')
}
stages{
stage("GIT Checkout"){
steps{
script {
if (params.TAG != '') {
checkout scm: [$class: 'GitSCM',
userRemoteConfigs: [[
url: 'https://github.com/lucabem/jenkins-devops',
credentialsId: 'd2f98590-f40a-4262-b302-6dee9ce15f5c'
]],
branches: [[name: 'refs/tags/${TAG}']]],
poll: false
} else {
checkout scm
}
}
}
}
stage("Setting up"){
steps{
sh 'python --version'
sh 'python -m pip install --user -r requirements.txt'
}
}
stage("Testing") {
steps{
sh "python setup.py -q pytest"
}
post {
success {
echo "Tests has been ended successfully - Well done!"
}
failure {
echo "There are some erros on tests - Try to solve them!"
}
}
}
stage("Deploy") {
steps{
sh "python main.py --collection_name ${params.CHOICES} --card_ids ${params.ids}"
}
}
}
post{
always{
cleanWs()
}
}
}