refs TG-3: build Windows Qt

This commit is contained in:
2026-05-02 19:02:11 +03:00
parent 7af1556fd8
commit 2fc664a305
Vendored
+36 -29
View File
@@ -48,68 +48,75 @@ pipeline {
def result = currentBuild.currentResult ?: 'UNKNOWN'
withCredentials([string(credentialsId: 'TAIGA_TOKEN', variable: 'TAIGA_TOKEN')]) {
powershell(returnStatus: true, script: """
\$commitMsg = git log -1 --pretty=%B
\$match = [regex]::Match(\$commitMsg, 'TG-(\\d+)')
writeFile file: 'taiga-post.ps1', text: '''
$ErrorActionPreference = "Continue"
if (-not \$match.Success) {
$commitMsg = git log -1 --pretty=%B
$match = [regex]::Match($commitMsg, 'TG-(\\d+)')
if (-not $match.Success) {
Write-Host "No TG-* reference found"
exit 0
}
\$ref = \$match.Groups[1].Value
\$headers = @{
Authorization = "Bearer \$env:TAIGA_TOKEN"
$ref = $match.Groups[1].Value
$headers = @{
Authorization = "Bearer $env:TAIGA_TOKEN"
"Content-Type" = "application/json"
}
\$targets = @(
$targets = @(
@{ endpoint = "userstories"; label = "User Story" },
@{ endpoint = "issues"; label = "Issue" },
@{ endpoint = "tasks"; label = "Task" }
)
\$found = \$null
$found = $null
foreach (\$target in \$targets) {
foreach ($target in $targets) {
try {
\$url = "\$env:TAIGA_URL/api/v1/\$(\$target.endpoint)/by_ref?project=\$env:TAIGA_PROJECT_ID&ref=\$ref"
\$data = Invoke-RestMethod -Uri \$url -Headers \$headers -Method Get
if (\$data.id) {
\$found = @{
endpoint = \$target.endpoint
label = \$target.label
data = \$data
$url = "$env:TAIGA_URL/api/v1/$($target.endpoint)/by_ref?project=$env:TAIGA_PROJECT_ID&ref=$ref"
$data = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
if ($data.id) {
$found = @{
endpoint = $target.endpoint
label = $target.label
data = $data
}
break
}
} catch {
Write-Host "Taiga lookup warning: \$($_.Exception.Message)"
Write-Host "Taiga lookup warning: $($_.Exception.Message)"
}
}
if (-not \$found) {
Write-Host "Taiga TG-\$ref not found"
if (-not $found) {
Write-Host "Taiga TG-$ref not found"
exit 0
}
\$comment = "Jenkins Windows Qt build #$env:BUILD_NUMBER: ${result}`n$env:BUILD_URL"
$comment = "Jenkins Windows Qt build #$env:BUILD_NUMBER: $env:BUILD_RESULT`n$env:BUILD_URL"
\$body = @{
comment = \$comment
version = \$found.data.version
$body = @{
comment = $comment
version = $found.data.version
} | ConvertTo-Json
try {
\$url = "\$env:TAIGA_URL/api/v1/\$(\$found.endpoint)/\$(\$found.data.id)"
Invoke-RestMethod -Uri \$url -Headers \$headers -Method Patch -Body \$body
Write-Host "Commented Taiga TG-\$ref (\$(\$found.label))"
$url = "$env:TAIGA_URL/api/v1/$($found.endpoint)/$($found.data.id)"
Invoke-RestMethod -Uri $url -Headers $headers -Method Patch -Body $body
Write-Host "Commented Taiga TG-$ref ($($found.label))"
} catch {
Write-Host "Taiga comment warning: \$($_.Exception.Message)"
Write-Host "Taiga comment warning: $($_.Exception.Message)"
}
exit 0
""")
'''
withEnv(["BUILD_RESULT=${result}"]) {
powershell(returnStatus: true, file: 'taiga-post.ps1')
}
}
}
}