Updates CI notification in Jenkinsfile
Updates the Jenkinsfile to ensure proper JSON formatting for the list of artifact URLs passed to the CI notification service. This ensures that the recipient correctly interprets the download links.
This commit is contained in:
63
Jenkinsfile
vendored
63
Jenkinsfile
vendored
@@ -89,37 +89,34 @@ pipeline {
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
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"
|
||||
}
|
||||
success {
|
||||
script {
|
||||
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"
|
||||
}
|
||||
// Convertir en une chaîne JSON valide d'URLs
|
||||
def urlsJson = urlsList.collect { "\"${it}\"" }.join(',')
|
||||
urlsJson = "[${urlsJson}]"
|
||||
|
||||
def urlsJson = urlsList.collect { "\"${it}\"" }.join(',')
|
||||
urlsJson = "[${urlsJson}]"
|
||||
|
||||
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\\":[]}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
always {
|
||||
cleanWs(deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
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\\":[]}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user