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