vanastassiou / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
0 stars 0 forks source link

[BUG]: Debug output has TrigerringPipeline [sic] set to true but trigerringBuild set to 0 when triggered by upstream pipeline #1

Open vanastassiou opened 7 months ago

vanastassiou commented 7 months ago

What happened?

When a pipeline is triggered by another pipeline's stage completion, the debug output is as follows when downloading the pipeline artifact:

##[debug]BuildResult: Succeeded
##[debug]Run: Specific
##[debug]ProjectId: 0f57f56b-9789-486b-a9a4-a35cf09ff7fa
##[debug]TrigerringPipeline: true
##[debug]Environment: Build
##[debug]PipelineId from trigerringBuild: 0
##[debug]PipelineVersionToDownload: latest
##[debug]PipelineId from non-trigerringBuild: 209139

Versions

==============================================================================
Task         : Download Pipeline Artifacts
Description  : Download build and pipeline artifacts
Version      : 2.198.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/download-pipeline-artifact
==============================================================================

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

No response

Version controll system

No response

Relevant log output

No response

vanastassiou commented 7 months ago

Some attributes of the triggered (downstream) pipeline that will be handy for implementing a fix:

# az pipelines runs show --id $triggering_pipeline_execution_id --output json
{
  "triggerInfo": {
    "alias": "Triggering_Pipeline",
    "artifactType": "Pipeline",
    "pipelineId": "[ID number of upstream triggering pipeline execution]",
    "pipelineTriggerType": "PipelineCompletion",
    "projectId": "[REDACTED]",
    "source": "[Friendly name of upstream triggering pipeline definition as seen in ADO Pipelines GUI]",
    "version": "[$date.number of upstream triggering pipeline execution as seen in ADO Pipelines GUI]"
  },
  "triggeredByBuild": null,
}
vanastassiou commented 7 months ago

The logic to look at is in src/Agent.Plugins/PipelineArtifact/PipelineArtifactPluginV2.cs