-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
81 lines (74 loc) · 1.83 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
77
78
79
80
81
pipeline {
agent any
environment {
FLASK_APP = 'dlapi'
FLASK_ENV = 'development'
JD_DEVICE = credentials('JDownloaderDevice')
RD_KEY = credentials('RealDebridAPIKey')
API_KEY = 'thisisatestapikey'
ENABLE_CORS_PROXY = true
USER_PASS = 'test'
SESSION_EXPIRY_DAYS = 1
JD_USER = credentials('JDownloaderUser')
JD_PASS = credentials('JDownloaderPass')
JACKETT_URL = credentials('JackettURL')
JACKETT_API_KEY = credentials('JackettAPIKey')
DOCKERHUB_CREDENTIALS = credentials('dockerhub-login-pocable')
}
stages {
stage('requirements') {
steps {
sh '''
#!/bin/bash
python3.9 -m pip install -r requirements.txt
python3.9 -m pip install .
'''
}
}
stage('test') {
steps {
sh '''
#!/bin/bash
python3.9 -m nose --with-xunit
'''
}
}
stage('build') {
steps {
script {
if(env.BRANCH_NAME == 'master'){
sh 'docker build -t pocable/dlapi:latest .'
} else if(env.BRANCH_NAME == 'beta'){
sh 'docker build -t pocable/dlapi:edge .'
} else {
sh 'docker build -t pocable/dlapi .'
}
}
}
}
stage('login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('deploy') {
steps {
script {
if(env.BRANCH_NAME == 'master'){
sh 'docker push pocable/dlapi:latest'
} else if(env.BRANCH_NAME == 'beta'){
sh 'docker push pocable/dlapi:edge'
} else {
echo 'Branch is not master/beta. Skipping deploy.'
}
}
}
}
}
post {
always {
sh 'docker logout'
junit '**/nosetests.xml'
}
}
}