61 lines
1.4 KiB
Groovy
61 lines
1.4 KiB
Groovy
@Library('cadoles') _
|
|
|
|
pipeline {
|
|
agent {
|
|
dockerfile {
|
|
label 'docker'
|
|
filename 'Dockerfile'
|
|
dir 'misc/jenkins'
|
|
args '-v /var/run/docker.sock:/var/run/docker.sock --network host'
|
|
}
|
|
}
|
|
|
|
stages {
|
|
stage('Cancel older jobs') {
|
|
steps {
|
|
script {
|
|
def buildNumber = env.BUILD_NUMBER as int
|
|
if (buildNumber > 1) milestone(buildNumber - 1)
|
|
milestone(buildNumber)
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Run unit tests') {
|
|
steps {
|
|
script {
|
|
sh 'make test'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Release') {
|
|
when {
|
|
anyOf {
|
|
branch 'master'
|
|
branch 'develop'
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
withCredentials([
|
|
usernamePassword([
|
|
credentialsId: 'forge-jenkins',
|
|
usernameVariable: 'GITEA_RELEASE_USERNAME',
|
|
passwordVariable: 'GITEA_RELEASE_PASSWORD'
|
|
])
|
|
]) {
|
|
sh 'make gitea-release'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|