Skip to content

Commit

Permalink
Добавлен типовой Jenkinsfile для build.oscript.io fix #27
Browse files Browse the repository at this point in the history
  • Loading branch information
artbear committed Oct 18, 2017
1 parent 80412a9 commit 7073faf
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@

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'
junit 'tests.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()
}
}
}
}

0 comments on commit 7073faf

Please sign in to comment.