Skip to content

Commit abcca2c

Browse files
committed
Типовой jenkinsfile
1 parent 197fe98 commit abcca2c

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

Jenkinsfile

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

0 commit comments

Comments
 (0)