Basic example with preparation and build stageΒΆ
This example is very simple bootsrap that can be used for basic setup
#!/env/bin/env groovy
@Library("m2aJenkins") _
pipeline {
agent any
stages {
stage("Prepare") {
steps {
script {
builder = docker.image("alpine")
}
}
}
stage("Build") {
steps {
script {
utils.build_notify(currentBuild, 'dummy-build', "Dummy build without any tests"){
builder.inside {
sh 'mkdir -p my-build'
sh 'echo built > my-build/my_artifact_0.0.0.raw'
}
}
}
}
}
}
post {
success {
script {
utils.build_notify(currentBuild, 'artifact', "Deliver artifact"){
builder.inside {
def artName = artifacts.create_artifact('my-build')
currentBuild.displayName += " [${artName}]"
return "Artifact ${artName} has been created"
}
}
}
}
cleanup {
cleanWs()
}
}
}