Skip to content

[BUG]: Summary file is re-published when rerunning only a failed downstream job #21550

@marialinea

Description

@marialinea

New issue checklist

Task name

uploadsummary

Task version

No response

Issue Description

In Azure Pipelines, I have a multi-job stage that executes:

  1. A Terraform plan job (generates and uploads a Markdown summary via ##vso[task.uploadsummary])
  2. A Gate job (ManualValidation@0) that depends on the plan
  3. 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 messages

Full task logs with system.debug enabled

No response

Repro steps

  1. Run the pipeline.
  2. Let the Terraform plan job complete successfully.
    → One summary is published as expected.
  3. Allow the Gate job (ManualValidation@0) to time out after 60 seconds.
    → Gate job fails.
    4.Click “Rerun failed jobs”.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions