-
Notifications
You must be signed in to change notification settings - Fork 19
/
Jenkinsfile
97 lines (76 loc) · 2.56 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
pipeline {
agent none
options {
buildDiscarder(logRotator(numToKeepStr: '7'))
skipDefaultCheckout()
}
stages {
stage('Тестирование кода пакета WIN') {
agent { label 'windows' }
steps {
checkout scm
script {
if( fileExists ('tasks/test.os') ){
bat 'chcp 65001 > nul && oscript tasks/test.os'
if( fileExists ('tests.xml') ){
junit 'tests.xml'
}
if( fileExists ('bdd-log.xml') ){
junit 'bdd-log.xml'
}
}
else
echo 'no testing task'
}
}
}
stage('Тестирование кода пакета LINUX') {
agent { label 'master' }
steps {
echo 'under development'
}
}
stage('Сборка пакета') {
agent { label 'windows' }
steps {
checkout scm
bat 'erase /Q *.ospx'
bat 'chcp 65001 > nul && call opm build .'
stash includes: '*.ospx', name: 'package'
archiveArtifacts '*.ospx'
}
}
stage('Публикация в хабе') {
when {
branch 'master'
}
agent { label 'master' }
steps {
sh 'rm -f *.ospx'
unstash 'package'
sh '''
artifact=`ls -1 *.ospx`
basename=`echo $artifact | sed -r 's/(.+)-.*(.ospx)/\\1/'`
cp $artifact $basename.ospx
sudo rsync -rv *.ospx /var/www/hub.oscript.io/download/$basename/
'''.stripIndent()
}
}
stage('Публикация в нестабильном хабе') {
when {
branch 'develop'
}
agent { label 'master' }
steps {
sh 'rm -f *.ospx'
unstash 'package'
sh '''
artifact=`ls -1 *.ospx`
basename=`echo $artifact | sed -r 's/(.+)-.*(.ospx)/\\1/'`
cp $artifact $basename.ospx
sudo rsync -rv *.ospx /var/www/hub.oscript.io/dev-channel/$basename/
'''.stripIndent()
}
}
}
}