From b1ba23f9c0ed0d9d0cbaf5efdc5a31c7224cc2b0 Mon Sep 17 00:00:00 2001 From: CatChow0 Date: Wed, 8 Oct 2025 18:56:15 +0200 Subject: [PATCH] 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. --- Jenkinsfile | 63 +++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0e8a707..5f604a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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\\":[]}" + """ + } + } + } +} \ No newline at end of file