65 lines
1.6 KiB
Groovy
65 lines
1.6 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'
|
|
branch 'ci-docker-release'
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
withCredentials([
|
|
usernamePassword([
|
|
credentialsId: 'forge-jenkins',
|
|
usernameVariable: 'GITEA_RELEASE_USERNAME',
|
|
passwordVariable: 'GITEA_RELEASE_PASSWORD'
|
|
])
|
|
]) {
|
|
sh 'make gitea-release'
|
|
sh '''
|
|
make docker-build docker-release
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|