Jenkins Test #12

This commit is contained in:
2025-10-08 18:10:28 +02:00
parent 2f5a970a4e
commit 14c07f8750

59
Jenkinsfile vendored
View File

@@ -87,33 +87,34 @@ pipeline {
}
post {
success {
script {
def urls = []
if (params.BUILD_TYPE in ['Both','Debug']) {
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip"
}
if (params.BUILD_TYPE in ['Both','Release']) {
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip"
}
bat """
curl -X POST http://192.168.1.131:2500/ci-notify ^
-H "Content-Type: application/json" ^
-d "{\\"userId\\": \\"${params.DISCORD_USER_ID}\\",\\"status\\": \\"success\\",\\"urls\\":${groovy.json.JsonOutput.toJson(urls)}}"
"""
}
}
failure {
script {
bat """
curl -X POST http://192.168.1.131:2500/ci-notify ^
-H "Content-Type: application/json" ^
-d "{\\"userId\\": \\"${params.DISCORD_USER_ID}\\",\\"status\\": \\"failure\\",\\"urls\\":[]}"
"""
}
}
always {
cleanWs(deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true)
}
}
success {
script {
// Construit une liste de chaînes JSON manuellement
def urlsList = []
if (params.BUILD_TYPE in ['Both','Debug']) {
urlsList << "\"${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip\""
if (params.BUILD_TYPE in ['Both','Release']) {
urlsList << "\"${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip\""
}
def urlsJson = "[${urlsList.join(',')}]"
bat """
curl -X POST http://192.168.1.131:2500/ci-notify ^
-H "Content-Type: application/json" ^
-d "{\\"userId\\": \\"${params.DISCORD_USER_ID}\\",\\"status\\": \\"success\\",\\"urls\\":${urlsJson}}"
"""
}
}
failure {
script {
bat """
curl -X POST http://192.168.1.131:2500/ci-notify ^
-H "Content-Type: application/json" ^
-d "{\\"userId\\": \\"${params.DISCORD_USER_ID}\\",\\"status\\": \\"failure\\",\\"urls\\":[]}"
"""
}
}
}
}