microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.21k stars 934 forks source link

New Pipeline resource variable 'resources.pipeline.<Alias>.requestedForEmail' #559

Closed kandula-aswin closed 2 years ago

kandula-aswin commented 2 years ago

We have a Pipeline A (CI) that is triggered from a commit to Azure Repo.

In the pipeline we can print the following Pre-defined variables

pool:
  vmImage: 'ubuntu-latest'
steps:
- bash: |
    echo "Requested User: $(Build.RequestedFor)"
    echo "Requested Email: $(Build.RequestedForEmail)"
  displayName: 'Print email'

Output:

"Requested User: Adb Def"
"Requested Email: abc.def@example.com"

Subsequently we Pipeline B (CD) triggered by a pipelines resource. It has a set of Pipeline resource variables

trigger: none
resources:
  pipelines:
  - pipeline: build
    source: CiPipeline
    trigger:
      branches:
        include:
        - '*'
pool:
  vmImage: 'ubuntu-latest'
steps:
- bash: |
    echo "Requested User: $(resources.pipeline.build.RequestedFor)"
    echo "Requested Email: $(resources.pipeline.build.RequestedForEmail)"
  displayName: 'Print email'

Output:

"Requested User: Adb Def"
"Requested Email: $(resources.pipeline.build.RequestedForEmail)"

Can resources.pipeline.build.RequestedForEmail be pre-populated with Build.RequestedForEmail value?

EzzhevNikita commented 2 years ago

Hi @kandula-aswin this repo is mostly for yaml templates support located in this repo - for any questions regarding Azure DevOps I would suggest to open ticket on https://developercommunity.visualstudio.com/search?space=21 to get right eyes on it.

kandula-aswin commented 2 years ago

Thank you @EzzhevNikita, along with Pipelines template, resources too is core yaml https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema

I have taken your advice and submitted a question here too https://developercommunity.visualstudio.com/t/Missing-Pipeline-resource-variable-reso/1654282

EzzhevNikita commented 2 years ago

@kandula-aswin Let me close the item in this repo since we have you have created it in the developer community.