Skip to content

Commit eabc325

Browse files
committed
Add jenkinsfile
1 parent 2b42eba commit eabc325

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
tests\.xml

Jenkinsfile

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
pipeline {
3+
agent none
4+
options {
5+
buildDiscarder(logRotator(numToKeepStr: '7'))
6+
skipDefaultCheckout()
7+
}
8+
9+
stages {
10+
stage('Тестирование кода пакета WIN') {
11+
12+
agent { label 'windows' }
13+
14+
steps {
15+
checkout scm
16+
17+
script {
18+
if( fileExists ('tasks/test.os') ){
19+
bat 'chcp 65001 > nul && oscript tasks/test.os'
20+
junit 'tests.xml'
21+
}
22+
else
23+
echo 'no testing task'
24+
}
25+
26+
}
27+
28+
}
29+
30+
stage('Тестирование кода пакета LINUX') {
31+
32+
agent { label 'master' }
33+
34+
steps {
35+
echo 'under development'
36+
}
37+
38+
}
39+
40+
stage('Сборка пакета') {
41+
42+
agent { label 'windows' }
43+
44+
steps {
45+
checkout scm
46+
47+
bat 'erase /Q *.ospx'
48+
bat 'chcp 65001 > nul && call opm build .'
49+
50+
stash includes: '*.ospx', name: 'package'
51+
archiveArtifacts '*.ospx'
52+
}
53+
54+
}
55+
56+
stage('Публикация в хабе') {
57+
when {
58+
branch 'master'
59+
}
60+
agent { label 'master' }
61+
steps {
62+
sh 'rm -f *.ospx'
63+
unstash 'package'
64+
65+
sh '''
66+
artifact=`ls -1 *.ospx`
67+
basename=`echo $artifact | sed -r 's/(.+)-.*(.ospx)/\\1/'`
68+
cp $artifact $basename.ospx
69+
sudo rsync -rv *.ospx /var/www/hub.oscript.io/download/$basename/
70+
'''.stripIndent()
71+
}
72+
}
73+
74+
stage('Публикация в нестабильном хабе') {
75+
when {
76+
branch 'develop'
77+
}
78+
agent { label 'master' }
79+
steps {
80+
sh 'rm -f *.ospx'
81+
unstash 'package'
82+
83+
sh '''
84+
artifact=`ls -1 *.ospx`
85+
basename=`echo $artifact | sed -r 's/(.+)-.*(.ospx)/\\1/'`
86+
cp $artifact $basename.ospx
87+
sudo rsync -rv *.ospx /var/www/hub.oscript.io/dev-channel/$basename/
88+
'''.stripIndent()
89+
}
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)