azure托管的Mac管道,关于如何使其更快(目前非常慢)的建议,在台式机上运行5分钟,在20点附近的服务器上 [英] azure hosted mac pipeline , suggestion on how to make it faster , currently very slow , on desktop 5 min , on server near 20

查看:72
本文介绍了azure托管的Mac管道,关于如何使其更快(目前非常慢)的建议,在台式机上运行5分钟,在20点附近的服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个管道,效果很好,但是在每次构建时都非常耗时桌面xcode只需不到5分钟即可完成构建,而在mac cloud服务器中则只需20分钟
尤其是它下载的部分会在
中配置和编译本机gem.安装宝石和cocoapods脚本";任务波纹管
然后出现以下Fastlane任务:"run fastlane"
编译部分很慢的地方...
我正在寻找提示和技巧,或者更好地组织我的渠道以加快构建速度

i have this pipeline which works great but is very time consuming each build when in desktop xcode it takes less then 5 min to build, in the mac cloud server its takes 20
especlly the parts where it downloads configures and compiles native gems in the
"installing gems and cocoapods script" task bellow
and then there is the Fastlane task bellow : "run fastlane"
where the compilation part is very slow ...
I'm looking for tips and tricks or organize better my pipeline for faster build

    pool:
      vmImage: 'macOS 10.14'
        
    variables:
      scheme: ''
      sdk: 'iphoneos'
      configuration: 'Release'
      
    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: 30
    
      pool:
        vmImage: 'macOS 10.14'
      steps:
      - script: echo 'Setting up 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
         pod deintegrate
         gem install cocoapods
         pod install    
         pod --version
         
        workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
        displayName: 'installing gems and cocoapods'
      
      - script:  |
         echo 'Start invoking Fastfile'
         fastlane release --verbose
         echo 'Done invoking Fastfile'
        failOnStderr: false 
        workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
        displayName: 'run fastlane'
      
      - task: PublishBuildArtifacts@1
        inputs:
          PathtoPublish: '$(Build.ArtifactStagingDirectory)'
          ArtifactName: 'Artifacts'
          publishLocation: 'Container'
          
    - job: copy_back_files_to_self_hosted_connect
      dependsOn: mac_agent 
      timeoutInMinutes: 30
      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}}'

使用缓存更新

我添加了缓存部分,但是在运行时它给了我一个错误

i added the cache section but it gives me an error when i run it

 Resolving key:
2020-10-01T11:39:48.3151700Z  - gems       [string]
2020-10-01T11:39:48.3241700Z  - "Darwin"   [string]
2020-10-01T11:39:48.3720810Z  - my.gemspec [file] (not found)
2020-10-01T11:39:48.3882910Z ##[error]One or more errors occurred. (File not found: my.gemspec)
2020-10-01T11:39:48.4094600Z ##[section]Finishing: Cache gems




    

池:vmImage:'macOS 10.14'

pool: vmImage: 'macOS 10.14'

variables:
  scheme: ''
  sdk: 'iphoneos'
  configuration: 'Release'
  BUNDLE_PATH: $(Pipeline.Workspace)/.bundle
  
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: 30

  pool:
    vmImage: 'macOS 10.14'
  steps:
  - script: echo 'Setting up 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)'  
  
  - task: Cache@2
    inputs:
       key: 'gems | "$(Agent.OS)" | my.gemspec'
       restoreKeys: | 
        gems | "$(Agent.OS)"
        gems
       path: $(BUNDLE_PATH)
    displayName: Cache gems
  
  - script:  |
     
     gem install --no-document bundler
     bundle update --bundler
     bundle install --retry=3 --jobs=4 
     gem install --no-document fastlane    
     
    workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
    displayName: 'installing gems and cocoapods'
 
 - script:  |
     pod deintegrate      
     gem install cocoapods     
     pod install      
     pod --version
    workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
    displayName: 'pod and cocoapods install '
  
  - script:  |
     echo 'Start invoking Fastfile'
     fastlane release --verbose
     echo 'Done invoking Fastfile'
    failOnStderr: false 
    workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
    displayName: 'run fastlane'
  
  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: 'Artifacts'
      publishLocation: 'Container'
      
- job: copy_back_files_to_self_hosted_connect
  dependsOn: mac_agent 
  timeoutInMinutes: 30
  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}}'

推荐答案

您可以尝试使用自托管代理而不是Microsoft托管代理.

You can try to use Self-hosted agents instead of Microsoft-hosted agents.

  • 在Microsoft托管的代理中,每次运行管道时,都会得到一个新鲜的虚拟机.一台虚拟机被丢弃使用.
  • 在自托管代理中,计算机级缓存和配置持续存在从头到尾运行,可以提高速度.

此文档.

See Capabilities and limitations of Microsoft-hosted agents in this document. If you want to install and use a self-hosted agent, you can refer to this document.

这篇关于azure托管的Mac管道,关于如何使其更快(目前非常慢)的建议,在台式机上运行5分钟,在20点附近的服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆