-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
uploadsummary
Task version
No response
Issue Description
In Azure Pipelines, I have a multi-job stage that executes:
- A Terraform plan job (generates and uploads a Markdown summary via ##vso[task.uploadsummary])
- A Gate job (ManualValidation@0) that depends on the plan
- An Apply job that depends on both
The Terraform plan job uploads the summary once as expected during the initial run.
However, if the Gate job times out (it has a 60-second timeout) and I press “Rerun failed jobs”, Azure Pipelines publishes a new copy of the summary even though:
- The Terraform plan job is NOT executed again
- Its summary-publishing step is NOT re-invoked
- Only the Gate job runs
The summary file content (including attempt metadata) proves the plan job did not rerun. So if I rerun the gate job X times I get X copies of the same summary file in the extension tab.
This appears to be unexpected behavior because publishing a new summary should only occur when a task explicitly emits ##vso[task.uploadsummary], and that does not happen during the gate rerun.
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Ubuntu 22.04
Relevant log output
No current error messagesFull task logs with system.debug enabled
No response
Repro steps
- Run the pipeline.
- Let the Terraform plan job complete successfully.
→ One summary is published as expected. - Allow the Gate job (ManualValidation@0) to time out after 60 seconds.
→ Gate job fails.
4.Click “Rerun failed jobs”. - Observe:
- Gate job reruns and completes
- The Terraform plan job does not rerun
- A second summary is published, containing the exact same header with the same attempt-value
---
# Root pipeline
---
# Terraform plan job
- template: jobs-terraform-plan.yaml
parameters:
job_name: plan_${{ parameters.name_suffix }}
...
# Gate job
- template: jobs-gate.yaml
parameters:
job_name: gate_${{ parameters.name_suffix }}
depends_on: plan_${{ parameters.name_suffix }}
# Apply job
- template: jobs-terraform-apply.yaml
parameters:
job_name: apply_${{ parameters.name_suffix }}
depends_on:
- plan_${{ parameters.name_suffix }}
- gate_${{ parameters.name_suffix }}
---
# jobs-terraform-plan (relevant part)
---
- task: PowerShell@2
displayName: Publish generated Terraform plan
condition: and(succeeded(), eq(variables['tf_plan.noChanges'], 'False'))
inputs:
targetType: 'inline'
script: |
$jobName = '$(Agent.JobName)'
$attempt = '$(System.JobAttempt)'
$summaryFile = "${{ parameters.terraform_plan_name }}-summary.md"
if (-not (Test-Path $summaryFile)) {
"# Terraform plans summary (job: $jobName, attempt: $attempt)" |
Out-File -FilePath $summaryFile -Encoding utf8
}
Write-Host "##vso[task.uploadsummary]${{ parameters.working_directory }}/$summaryFile"
---
# jobs-gate
---
steps:
- task: ManualValidation@0
timeoutInMinutes: 1