Jenkins Test #15
This commit is contained in:
91
Jenkinsfile
vendored
91
Jenkinsfile
vendored
@@ -53,27 +53,26 @@ pipeline {
|
|||||||
when { expression { params.BUILD_TYPE in ['Both','Debug'] } }
|
when { expression { params.BUILD_TYPE in ['Both','Debug'] } }
|
||||||
steps {
|
steps {
|
||||||
powershell """
|
powershell """
|
||||||
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
|
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
|
||||||
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
|
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
|
||||||
}
|
}
|
||||||
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Debug\\*\" `
|
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Debug\\*\" `
|
||||||
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Debug.zip\" `
|
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Debug.zip\" `
|
||||||
-Force
|
-Force
|
||||||
"""
|
"""
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Package Release') {
|
stage('Package Release') {
|
||||||
when { expression { params.BUILD_TYPE in ['Both','Release'] } }
|
when { expression { params.BUILD_TYPE in ['Both','Release'] } }
|
||||||
steps {
|
steps {
|
||||||
powershell """
|
powershell """
|
||||||
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
|
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) {
|
||||||
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
|
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null
|
||||||
}
|
}
|
||||||
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Release\\*\" `
|
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Release\\*\" `
|
||||||
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Release.zip\" `
|
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Release.zip\" `
|
||||||
-Force
|
-Force
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,35 +86,37 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
script {
|
script {
|
||||||
// Prépare la liste d'URL brutes
|
def urls = []
|
||||||
def urlsList = []
|
if (params.BUILD_TYPE in ['Both','Debug']) {
|
||||||
if (params.BUILD_TYPE in ['Both','Debug']) {
|
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip"
|
||||||
urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip"
|
}
|
||||||
}
|
if (params.BUILD_TYPE in ['Both','Release']) {
|
||||||
if (params.BUILD_TYPE in ['Both','Release']) {
|
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip"
|
||||||
urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip"
|
}
|
||||||
}
|
// Construire le JSON correct pour l'envoi
|
||||||
// Fabrication manuelle d'un JSON array de strings
|
def urlsJson = urls.collect { "\"${it}\"" }.join(',')
|
||||||
def urlsJson = urlsList.collect { "\"${it}\"" }.join(',' )
|
urlsJson = "[${urlsJson}]"
|
||||||
urlsJson = "[${urlsJson}]"
|
|
||||||
|
|
||||||
bat """
|
bat """
|
||||||
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
||||||
-H "Content-Type: application/json" ^
|
-H "Content-Type: application/json" ^
|
||||||
-d "{\\"userId\\":\\"${params.DISCORD_USER_ID}\\",\\"status\\":\\"success\\",\\"urls\\":${urlsJson}}"
|
-d "{\\"userId\\":\\"${params.DISCORD_USER_ID}\\",\\"status\\":\\"success\\",\\"urls\\":${urlsJson}}"
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
script {
|
script {
|
||||||
bat """
|
bat """
|
||||||
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
||||||
-H "Content-Type: application/json" ^
|
-H "Content-Type: application/json" ^
|
||||||
-d "{\\"userId\\":\\"${params.DISCORD_USER_ID}\\",\\"status\\":\\"failure\\",\\"urls\\":[]}"
|
-d "{\\"userId\\":\\"${params.DISCORD_USER_ID}\\",\\"status\\":\\"failure\\",\\"urls\\":[]}"
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
always {
|
||||||
|
cleanWs(deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user