How to identify branch name through the build id in yaml script or task whatever?

56 views Asked by At

Have validate thorough the different ways

- task: DownloadPipelineArtifact@2
  displayName: 'Download artifact'
  inputs:
    buildType: 'specific'
    project: '$(resources.pipeline.DfmPublish.projectID)'
    definition: '$(resources.pipeline.DfmPublish.pipelineID)'
    ${{ if eq(parameters.artifactBuildId, 'latestFromBranch') }}:
      buildVersionToDownload: 'latestFromBranch'
      branchName: 'refs/heads/${{ parameters.artifactBranch }}'
    ${{ if ne(parameters.artifactBuildId, 'latestFromBranch') }}:
      buildVersionToDownload: 'specific'
      runId: '${{ parameters.artifactBuildId }}'
      buildId: '$(resources.pipeline.DfmPublish.runID)'
      branchName: 'refs/heads/${{ parameters.artifactBranch }}'
    targetPath:  '$(System.ArtifactsDirectory)\aritfactname

and also run some script but it will run only for source branch

ex - there are 3 branches :

branch A is build branch and branch B is where we using build artifact .

If we use build id form branch C pipeline will select latest build from 'branch A' and if build Id from 'branch A' so no need to check latest branch from the branch A.

If we use build id form branch C pipeline will select latest build from 'branch A' and if build Id from 'branch A' so no need to check latest branch from the branch A.

0

There are 0 answers