I created pipeline pipeline.yaml called SourcePipeline in Azure DevOps.
Narrowed down to the essential part:
stages:
- stage: Pre-task
displayName: 'Pre-task execution'
jobs:
- job: PreparationJobs
displayName: 'Preparation Job'
steps:
- script: |
echo "$(Build.Repository.Uri)"
echo "$(Build.SourceBranchName)"
echo "$(Build.TriggeredBy.BuildId)"
In Azure DevOps I got some output to which I have questions:
- For $(Build.Repository.Uri) I got vstfs:///Build/Build/298101. Why didn’t I get the full url like https://dev.azure.com//?
- For $(Build.SourceBranch) I got test like a name of my branch. Make sense, no question.
- For $(Build.TriggeredBy.BuildId) I got “/home/vsts/work/_temp/4y828575020.sh: line 6: Build.TriggeredBy.BuildNumber: command not found” Why? How to reveal it?
I also created the second pipeline 2pipeline.yaml called DependantPipeline in Azure DevOps.
Narrowed down to the essential part:
trigger: none
resources:
pipelines:
- pipeline: SourcePipeline
source: 'SourcePipeline '
trigger:
branches:
include:
- dev/test
variables:
- name: BUILD_URI
value: $(Build.BuildUri)
- name: PROJECT_ID
value: $(System.TeamProjectId)
- name: TRIGGEREDBY
value: $(Build.TriggeredBy.BuildId)
- name: BRANCH_NAME
value: $(Build.SourceBranchName)
steps:
- script: |
echo "$(Build.BuildUri)"
echo "$(Build.SourceBranchName)"
echo "$(Build.TriggeredBy.BuildId)"
My goal is to show at least those variables which I pasted above based on the official documentation at the DependantPipeline in Azure DevOps. In this way I would know which pipeline triggered the DependantPipeline, plus several other useful information. However,
I am not able even shown that output from those variables in the origin pipeline, SourcePipeline. Nevertheless I want to see them in DependantPipeline pipeline.