builds/.archived/owntone/Jenkinsfile

104 lines
3.5 KiB
Groovy

def owntone_main_branch = "master"
pipeline {
agent any
parameters {
booleanParam(name: "rebase_filescans", defaultValue: false, description: "rebase branch for owntone-server#1179 from github:whatdoineed2do/forked-daapd")
booleanParam(name: "dark_reader", defaultValue: false, description: "experimental work in progress, add the dark-reader generated css to the build")
booleanParam(name: "build_web", defaultValue: true, description: "build the web ui, override the websocket url")
}
options {
timestamps()
ansiColor("xterm")
disableConcurrentBuilds()
// checkoutToSubdirectory('builds')
buildDiscarder(
logRotator(
// daysToKeepStr: '15',
// artifactDaysToKeepStr: '15',
numToKeepStr:'30',
artifactNumToKeepStr: '1'
)
)
}
// environment {
// WORKSPACE="${WORKSPACE}/owntone"
// }
stages {
stage('checkout') {
steps {
dir('owntone') {
// // can also use env.JOB_NAME
// sh "ln -s builds/owntone/builder builder"
// sh "ln -s builds/owntone/dark-reader dark-reader"
// sh "ln -s builds/owntone/docker docker"
script {
// clone the owntone repos
def mirrors = "https://git.sudo.is/mirrors"
dir('owntone-server') {
git url: "${mirrors}/owntone-server.git", branch: owntone_main_branch
}
dir('owntone-apt') {
git url: "${mirrors}/owntone-apt.git", branch: owntone_main_branch
}
sh "ls -l"
sh "pwd"
sh "ls -l dist"
// sh "ls -l builder/"
}
}
}
}
stage('rebase filescans branch') {
when {
expression {
params.rebase_filescans == true
}
}
steps {
dir('owntone/owntone-server') {
// add whatdoineed2d's fork and rebase their file-scan-dir branch if rebase_filescans is selected
script {
sh "git remote add whatdoineed2d https://github.com/whatdoineed2do/forked-daapd"
sh "git fetch whatdoineed2d file-scan-dir-path"
sh "git branch"
}
}
}
}
stage('build htdocs') {
when {
expression {
params.build_web == true
}
}
steps {
dir('owntone') {
script {
sh "builder/docker-run-build-web-src.sh"
dir ('dist/htdocs') {
sh "zip -r ../htdocs.zip ."
}
}
}
}
}
}
post {
success {
dir('owntone') {
archiveArtifacts(
artifacts: 'dist/*.tar.gz,dist/*.deb,dist/*.zip',
fingerprint: true
)
}
}
cleanup {
cleanWs(deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true)
}
}
}