2023-03-31 16:02:28 +02:00
|
|
|
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 {
|
2023-08-25 15:54:57 +02:00
|
|
|
branch 'master'
|
2023-03-31 16:02:28 +02:00
|
|
|
expression {
|
|
|
|
return params.emissaryRelease != 'latest'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
currentEmissaryRelease = readFile('emissary_release.txt').trim()
|
|
|
|
|
|
|
|
if (currentEmissaryRelease == params.emissaryRelease) {
|
|
|
|
currentBuild.result = 'SUCCESS'
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
withCredentials([
|
|
|
|
usernamePassword([
|
|
|
|
credentialsId: 'forge-jenkins',
|
|
|
|
usernameVariable: 'GIT_USERNAME',
|
|
|
|
passwordVariable: 'GIT_PASSWORD'
|
|
|
|
])
|
|
|
|
]) {
|
|
|
|
sh """
|
|
|
|
git config user.email "jenkins@cadoles.com"
|
|
|
|
git config user.name "Jenkins"
|
|
|
|
git config credential.https://forge.cadoles.com.username "\$GIT_USERNAME"
|
|
|
|
git config credential.https://forge.cadoles.com.helper '!f() { test "\$1" = get && echo "password=\$GIT_PASSWORD"; }; f'
|
|
|
|
|
|
|
|
echo '${params.emissaryRelease}' > emissary_release.txt
|
|
|
|
git add emissary_release.txt
|
|
|
|
git commit -m "feat: use emissary ${params.emissaryRelease}"
|
|
|
|
git push origin \$(git rev-parse HEAD):${env.GIT_BRANCH}
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-25 15:54:57 +02:00
|
|
|
stage('Build') {
|
2023-03-31 16:02:28 +02:00
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
withCredentials([
|
|
|
|
usernamePassword([
|
|
|
|
credentialsId: 'forge-jenkins',
|
|
|
|
usernameVariable: 'GITEA_DOWNLOAD_USERNAME',
|
|
|
|
passwordVariable: 'GITEA_DOWNLOAD_PASSWORD'
|
|
|
|
])
|
|
|
|
]) {
|
|
|
|
sh '''
|
|
|
|
make download-emissary-release
|
|
|
|
make all
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Release') {
|
2023-08-25 15:54:57 +02:00
|
|
|
when {
|
|
|
|
branch 'master'
|
|
|
|
}
|
2023-03-31 16:02:28 +02:00
|
|
|
steps {
|
|
|
|
withCredentials([
|
|
|
|
usernamePassword([
|
|
|
|
credentialsId: 'forge-jenkins',
|
|
|
|
usernameVariable: 'GITEA_RELEASE_USERNAME',
|
|
|
|
passwordVariable: 'GITEA_RELEASE_PASSWORD'
|
|
|
|
])
|
|
|
|
]) {
|
|
|
|
sh 'make gitea-release'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
cleanWs()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|