Skip to content

Commit 3e2272d

Browse files
committed
Универсальный Jenkinsfile #3
1 parent f55a73b commit 3e2272d

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

Jenkinsfile

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

0 commit comments

Comments
 (0)