93 lines
2.8 KiB
Groovy
93 lines
2.8 KiB
Groovy
pipeline {
|
|
agent any
|
|
// triggers {
|
|
// parameterizedCron('''@daily''')
|
|
// }
|
|
options {
|
|
timestamps()
|
|
ansiColor("xterm")
|
|
disableConcurrentBuilds()
|
|
skipDefaultCheckout()
|
|
}
|
|
stages {
|
|
stage('checkout') {
|
|
steps{
|
|
checkout scm
|
|
|
|
checkout([
|
|
$class: 'GitSCM',
|
|
branches: [[name: 'refs/heads/master']],
|
|
extensions: [[
|
|
$class: 'RelativeTargetDirectory',
|
|
relativeTargetDir: 'xmrig'
|
|
]],
|
|
doGenerateSubmoduleConfigurations: false,
|
|
// extensions: [[$class: 'CloneOption',
|
|
// depth: 1, noTags: false, shallow: true]],
|
|
userRemoteConfigs: [[
|
|
url: 'https://git.sudo.is/mirrors/xmrig.git'
|
|
]],
|
|
])
|
|
}
|
|
}
|
|
|
|
stage ('build') {
|
|
steps {
|
|
sh "docker build --pull -t xmrig-builder ."
|
|
}
|
|
}
|
|
stage('deb') {
|
|
steps {
|
|
script {
|
|
sh "docker container create --name xmrig_builder xmrig-builder"
|
|
sh "docker container cp xmrig_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: 'xmrig', type: 'EXCLUDE']],
|
|
disableDeferredWipeout: true,
|
|
notFailBuild: true
|
|
)
|
|
script {
|
|
sh "docker container rm xmrig_builder || true"
|
|
sh "ls -lah"
|
|
}
|
|
}
|
|
}
|
|
}
|