This commit is contained in:
ben 2024-12-13 05:14:53 +01:00
parent 862e14d2bc
commit 07498cb2ca
Signed by: ben
SSH Key Fingerprint: SHA256:oxvOAo1MvyGyg6MklU3f3G/hLIgXyCKI0PPlMSVONPo
2 changed files with 41 additions and 13 deletions

View File

@ -1,5 +1,5 @@
# ubuntu:latest is the latest LTS
FROM ubuntu:latest as base
FROM ubuntu:latest AS base
MAINTAINER Ben K <ben@sudo.is>
ENV DEBIAN_FRONTEND=noninteractive

52
Jenkinsfile vendored
View File

@ -10,7 +10,7 @@ pipeline {
}
stages {
stage('checkout') {
steps{
steps {
checkout scm
checkout([
@ -36,31 +36,44 @@ pipeline {
steps {
sh "docker build --pull -t blink1-tool-builder ."
}
}
stage('deb') {
steps {
script {
sh "docker rm blink1-tool_builder || true"
sh "docker container create --name blink1-tool_builder blink1-tool-builder"
sh "docker container cp blink1-tool_builder:/usr/local/src/dist/ ."
}
}
post {
always {
env.VERSION = readFile('dist/blink1_version.txt').trim()
env.DEBFILE = readFile('dist/debfile.txt').trim()
currentBuild.description = env.VERSION
}
success {
stash(name: "agent", includes: "dist/")
}
cleanup {
sh "docker container rm blink1-tool_builder"
}
}
}
}
post {
success {
script {
stage('upload') {
// its also possible to wrap steps in :
//
// node('built-in') {
// ...
// }
agent {
label "built-in"
}
steps {
sh(script: "hostname")
unstash(name: "agent")
archiveArtifacts(artifacts: "dist/${env.DEBFILE}", fingerprint: true)
// def timer = currentBuild.getBuildCauses()[0]["shortDescription"].matches("Started by timer")
// if (!fileExists("${env.JENKINS_HOME}/artifacts/${env.DEBFILE}}")) {
// }
sh "cp dist/${env.DEBFILE} ${env.JENKINS_HOME}/artifacts"
build(
@ -72,18 +85,33 @@ pipeline {
name: 'filename',
value: "${debfile}"
]])
}
post {
success(name: "agent", includes: "dist/")
}
}
}
post {
success {
agent {
label "built-in"
}
script {
sh(script: "hostname")
unstash(name: "agent")
archiveArtifacts(artifacts: "dist/${env.DEBFILE}", fingerprint: true)
}
}
cleanup {
sh "ls -lah"
sh "hostname"
cleanWs(
deleteDirs: true,
//patterns: [[pattern: 'blink1-tool-web', type: 'EXCLUDE']],
disableDeferredWipeout: true,
notFailBuild: true
)
sh "docker container rm blink1-tool_builder || true"
}
}
}