refs TG-3: build Windows Qt

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