Azure starting 2 self hosted servers deliver files to Azure managed agent both in pool but only 1 accepting copyfiles task

别等时光非礼了梦想. 提交于 2020-12-15 06:23:06

问题


I have a very strange behaver where I starting 2 self-hosted agents from my AWS server to deliver files to the managed agent in azure all with different names to be unique. but in the azure pipeline, i can see both pipelines are taking the files from only 1 place instead of taking files from its unique place in the self-hosting server.

here is the command I'm starting the self-hosting docker server : they all take form :

docker run -d --rm -t 
--name=ios_docker_128_linux_slave_2 
-e AZP_WORK=/var/jenkins/jenkins_slave/workspace/run_build_ios@2/128/ios_build_temp/working_dir 
-v /var/jenkins/jenkins_slave/workspace/run_build_ios@2/128/ios_build_temp/working_dir:/azp 
-e AZP_URL=https://dev.azure.com/xxx -e AZP_TOKEN=xxxx
-e AZP_AGENT_NAME=ios_docker_128_linux_slave_2 
xxx.xxx.com:1/azure_self_hosted_agent/agent:latest


docker run -d --rm -t 
--name=ios_docker_127_linux_slave_2 
-e AZP_WORK=/var/jenkins/jenkins_slave/workspace/run_build_ios/127/ios_build_temp/working_dir 
-v /var/jenkins/jenkins_slave/workspace/run_build_ios/127/ios_build_temp/working_dir:/azp 
-e AZP_URL=https://dev.azure.com/xxx 
-e AZP_TOKEN=xxxx 
-e AZP_AGENT_NAME=ios_docker_127_linux_slave_2 
xxx.xxx.com:1/azure_self_hosted_agent/agent:latest

but see in the azure pipeline they are taking the files fro the same place :
pay attention they all take the files from /run_build_ios/127

/var/jenkins/jenkins_slave/workspace/run_build_ios/127/ios_build_temp/working_dir/_temp/

look at the red markers

how my pipeline looks like :

pool:
  vmImage: 'macOS 10.14'
parameters:
  - name: Folderpath
    type: string
    displayName: 'configure path'
  - name: FolderCompile
    type: string
    displayName: 'Compile ios productes path'
  - name: projectName
    type: string
    displayName: 'ios projectName'
  - name: appIdentifier
    type: string
    displayName: 'ios appIdentifier'
  - name: versionNumber
    type: string
    displayName: 'ios versionNumber'
  - name: buildNumber
    type: string
    displayName: 'ios buildNumber'
  - name: plistFileFtpBasePath
    type: string
    displayName: 'ios plistFileFtpBasePath'
  - name: fastlaneAppleSession
    type: string
    displayName: 'ios fastlaneAppleSession'
    
  
    
variables:
  scheme: ''
  sdk: 'iphoneos'
  configuration: 'Release'
  CERTIFICATE_PASSWORD: xxxx
  FASTLANE_PASSWORD: xxxx 
  FASTLANE_SESSION: '${{parameters.fastlaneAppleSession}}'
  
jobs:
- job: self_hosted_connect
  timeoutInMinutes: 10
  pool: Default

  steps:
  
  
    
  - task: CopyFiles@2
    inputs:
      SourceFolder: '$(Agent.HomeDirectory)/../${{parameters.Folderpath}}'
      Contents: '**'
      TargetFolder: '$(build.artifactstagingdirectory)'
  - task: PublishBuildArtifacts@1
    inputs:
      pathToPublish: '$(build.artifactstagingdirectory)'
      artifactName: 'ios_artifacts'

- job: mac_agent
  dependsOn: self_hosted_connect   
  timeoutInMinutes: 10
 
  
  pool:
    vmImage: 'macOS 10.14'
 
 
  - task: UseRubyVersion@0
    inputs:
     versionSpec: '>= 2.4'
     addToPath: true
  
 
  - task: DownloadBuildArtifacts@0
    inputs:
      buildType: 'current'
      downloadType: 'single'
      artifactName: 'ios_artifacts'
      downloadPath: '$(System.ArtifactsDirectory)'
  
  
  - script:  |
   
     
     gem install --no-document bundler
     bundle update --bundler
     bundle install --retry=3 --jobs=4
     gem install --no-document fastlane
     
     mkdir fastlane
     mv Fastfile fastlane
     mv Appfile  fastlane
     
     
    
     pod deintegrate     
     gem install cocoapods     
     pod install     
     pod --version           
     
     fastlane release --verbose projectName:${{parameters.projectName}} appIdentifier:${{parameters.appIdentifier}} versionNumber:${{parameters.versionNumber}} buildNumber:${{parameters.buildNumber}} plistFileFtpBasePath:${{parameters.plistFileFtpBasePath}} ArtifactsDirectory:$(System.ArtifactsDirectory)

    workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
    displayName: 'create_keychain'
 
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: 'Artifacts'
      publishLocation: 'Container'
      
- job: copy_back_files_to_self_hosted_connect
  dependsOn: mac_agent 
  timeoutInMinutes: 10
  pool: Default
  steps:
    - task: DownloadBuildArtifacts@0
      inputs:
        buildType: 'current'
        downloadType: 'single'
        artifactName: 'Artifacts'
        itemPattern: '**/*.ipa|manifest.plist'
        downloadPath: '$(System.ArtifactsDirectory)'
    - task: CopyFiles@2
      inputs:
        SourceFolder: '$(System.ArtifactsDirectory)'
        Contents: '**/*.ipa|manifest.plist'
        TargetFolder: '$(Agent.HomeDirectory)/../${{parameters.FolderCompile}}'

also here you can see i have 3 agents ( the name is a bit different as i took the picture later but it always 3 up )

来源:https://stackoverflow.com/questions/64460219/azure-starting-2-self-hosted-servers-deliver-files-to-azure-managed-agent-both-i

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