92 lines
2.6 KiB
Groovy
92 lines
2.6 KiB
Groovy
pipeline {
|
|
agent {
|
|
dockerfile {
|
|
filename 'Dockerfile'
|
|
dir 'misc/jenkins'
|
|
}
|
|
}
|
|
|
|
parameters {
|
|
persistentText(name: 'emissaryRelease', defaultValue: 'latest', description: 'Numéro de release Emissary', successfulOnly: false)
|
|
}
|
|
|
|
stages {
|
|
stage('Cancel older jobs') {
|
|
steps {
|
|
script {
|
|
def buildNumber = env.BUILD_NUMBER as int
|
|
if (buildNumber > 1) milestone(buildNumber - 1)
|
|
milestone(buildNumber)
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Update emissary release') {
|
|
when {
|
|
expression {
|
|
return params.emissaryRelease != 'latest'
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
steps {
|
|
currentEmissaryRelease = readFile('emissary_release.txt')
|
|
|
|
if (currentEmissaryRelease == params.emissaryRelease) {
|
|
currentBuild.result = 'SUCCESS'
|
|
return
|
|
}
|
|
|
|
sh """
|
|
echo '${params.emissaryRelease}' > emissary_release.txt
|
|
git add emissary_release.txt
|
|
git commit -m "feat: use emissary ${params.emissaryRelease}"
|
|
git pull --rebase
|
|
git push
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Build') {
|
|
steps {
|
|
script {
|
|
withCredentials([
|
|
usernamePassword([
|
|
credentialsId: 'forge-jenkins',
|
|
usernameVariable: 'GITEA_DOWNLOAD_USERNAME',
|
|
passwordVariable: 'GITEA_DOWNLOAD_PASSWORD'
|
|
])
|
|
]) {
|
|
sh '''
|
|
make download-emissary-release
|
|
make all
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Release') {
|
|
steps {
|
|
withCredentials([
|
|
usernamePassword([
|
|
credentialsId: 'forge-jenkins',
|
|
usernameVariable: 'GITEA_RELEASE_USERNAME',
|
|
passwordVariable: 'GITEA_RELEASE_PASSWORD'
|
|
])
|
|
]) {
|
|
sh 'make gitea-release'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|