azure devops pipeline CopyFiles@2 task copy's files from agent A but DownloadBuildArtifacts@0 downloads the files to agent B

寵の児 提交于 2021-02-11 02:24:59

问题


i have wired behavior with the copy files from hosted agent and then downloading them back to the same agent looks like it copies the files from agent A but the same pipeline downloading them back to Agent B with is in another machine doing another build job that is not related

Upload from ios_docker_142_linux_slave_1

Download back to different agent ios_docker_141_linux_slave_3 , why ?

 - task: CopyFiles@2
    inputs:
      CleanTargetFolder: 'true'
      SourceFolder: '$(Agent.HomeDirectory)/../${{parameters.Folderpath}}'
      Contents: '**'
      TargetFolder: '$(build.artifactstagingdirectory)'

回答1:


This is an expected behavior if you are using parallel jobs. According to your screenshot, there are multiple jobs self-hosted connect , mac_agent, copy_back_files_to_self..

One agent one job at a time. If the agent is running a job, it will in busy status, and other jobs will look for idle agents to run . The parallel jobs is for running multiple jobs in multiple agents at a time.

To achieve what you want, you need to specify detail agent in your YAML file. The pool name needs to add to the name field, then you could add demands. You may try the following YAML Code:

stages:

- stage: Deploy

  pool: 

   name: AgentPoolName(e.g. alm-aws-pool)

   demands:

    - agent.name -equals Agentname (e.g. deploy-05-agent1)

  jobs:

  - job: BuildJob

    steps:

    - script: echo Building!


来源:https://stackoverflow.com/questions/64476518/azure-devops-pipeline-copyfiles2-task-copys-files-from-agent-a-but-downloadbui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!