92 lines
2.8 KiB
Groovy
92 lines
2.8 KiB
Groovy
pipeline {
|
|
agent any
|
|
triggers {
|
|
cron('''@weekly''')
|
|
}
|
|
options {
|
|
timestamps()
|
|
ansiColor("xterm")
|
|
disableConcurrentBuilds()
|
|
skipDefaultCheckout()
|
|
}
|
|
stages {
|
|
stage('checkout') {
|
|
steps{
|
|
checkout scm
|
|
|
|
checkout([
|
|
$class: 'GitSCM',
|
|
branches: [[name: 'refs/heads/master']],
|
|
extensions: [[
|
|
$class: 'RelativeTargetDirectory',
|
|
relativeTargetDir: 'synapse-admin'
|
|
]],
|
|
doGenerateSubmoduleConfigurations: false,
|
|
// extensions: [[$class: 'CloneOption',
|
|
// depth: 1, noTags: false, shallow: true]],
|
|
userRemoteConfigs: [[
|
|
url: 'https://git.sudo.is/matrix/synapse-admin.git'
|
|
]],
|
|
])
|
|
}
|
|
}
|
|
|
|
stage ('build') {
|
|
steps {
|
|
sh "docker build --pull -t synapse-admin-builder ."
|
|
}
|
|
}
|
|
stage('deb') {
|
|
steps {
|
|
script {
|
|
sh "docker container create --name synapse-admin_builder synapse-admin-builder"
|
|
sh "docker container cp synapse-admin_builder:/deb/target/ ."
|
|
def debfile = readFile("target/version.txt").trim()
|
|
currentBuild.description = "${debfile}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
script {
|
|
// def debfile = readFile("target/version.txt").trim()
|
|
def debfile = currentBuild.description
|
|
archiveArtifacts(
|
|
artifacts: 'target/' + debfile,
|
|
fingerprint: true
|
|
)
|
|
|
|
// def timer = currentBuild.getBuildCauses()[0]["shortDescription"].matches("Started by timer")
|
|
// if (!fileExists("${env.JENKINS_HOME}/artifacts/${debfile}")) {
|
|
// }
|
|
sh "cp target/${debfile} ${env.JENKINS_HOME}/artifacts"
|
|
|
|
build(
|
|
job: "/utils/apt",
|
|
wait: true,
|
|
propagate: true,
|
|
parameters: [[
|
|
$class: 'StringParameterValue',
|
|
name: 'filename',
|
|
value: "${debfile}"
|
|
]])
|
|
|
|
}
|
|
}
|
|
cleanup {
|
|
cleanWs(
|
|
deleteDirs: true,
|
|
//patterns: [[pattern: 'hydrogen-web', type: 'EXCLUDE']],
|
|
disableDeferredWipeout: true,
|
|
notFailBuild: true
|
|
)
|
|
script {
|
|
sh "docker container rm synapse-admin_builder || true"
|
|
sh "ls -lah"
|
|
}
|
|
}
|
|
}
|
|
}
|