Jenkins Test #15

This commit is contained in:
2025-10-08 18:23:09 +02:00
parent fc9a4bdc47
commit a2dc31f49c

93
Jenkinsfile vendored
View File

@@ -53,27 +53,26 @@ pipeline {
when { expression { params.BUILD_TYPE in ['Both','Debug'] } }
steps {
powershell """
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
}
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Debug\\*\" `
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Debug.zip\" `
-Force
"""
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
}
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Debug\\*\" `
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Debug.zip\" `
-Force
"""
}
}
stage('Package Release') {
when { expression { params.BUILD_TYPE in ['Both','Release'] } }
steps {
powershell """
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
}
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Release\\*\" `
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Release.zip\" `
-Force
"""
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
}
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Release\\*\" `
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Release.zip\" `
-Force
"""
}
}
}
@@ -87,35 +86,37 @@ pipeline {
}
post {
success {
script {
// Prépare la liste d'URL brutes
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"
}
// Fabrication manuelle d'un JSON array de strings
def urlsJson = urlsList.collect { "\"${it}\"" }.join(',' )
urlsJson = "[${urlsJson}]"
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"
}
// Construire le JSON correct pour l'envoi
def urlsJson = urls.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\\":[]}"
"""
}
}
}
}
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)
}
}
}