diff --git a/Jenkinsfile b/Jenkinsfile index 5f604a9..7d3de5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -98,25 +98,39 @@ pipeline { 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 data = [ + userId: params.DISCORD_USER_ID, + status: 'success', + urls: urlsList + ] + def jsonFile = "${env.WORKSPACE}\\payload.json" + writeFile file: jsonFile, text: groovy.json.JsonOutput.toJson(data) 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}}" + -H "Content-Type: application/json" ^ + --data @${jsonFile} """ } } failure { script { + def data = [ + userId: params.DISCORD_USER_ID, + status: 'failure', + urls: [] + ] + def jsonFile = "${env.WORKSPACE}\\payload-fail.json" + writeFile file: jsonFile, text: groovy.json.JsonOutput.toJson(data) + 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\\":[]}" + -H "Content-Type: application/json" ^ + --data @${jsonFile} """ } } } + } \ No newline at end of file