devops管道中的私人Cocapods回购

时间:2019-07-03 07:41:07

标签: ios azure azure-devops cocoapods

对我来说,与Azure Devops和iOS的合作是第一次。 我正在尝试为具有多个私有cocoapods存储库(PodXSource和私有规范存储库(projectPodSpecsRepository)的iOS应用在Azure devops中创建构建管道。

我似乎无法设法执行Azure Cocoapod任务。我尝试了几种方法,但是都没有用。我想念什么吗?

这是我的Yaml管道的一部分:

- script: 
          git clone https://$(gitUser):$(gitPat)@dev.azure.com/happydump/projectCore/_git/projectPodSpecsRepository

          git config --global credential.helper store

          git clone https://$(gitUser):$(gitPat)@dev.azure.com/happydump/projectCore/_git/Pod1Source

          git clone https://$(gitUser):$(gitPat)@dev.azure.com/happydump/projectEvaluations/_git/Pod2Source

          git clone https://$(gitUser):$(gitPat)@dev.azure.com/happydump/projectEvaluations/_git/Pod3Source

          git clone https://$(gitUser):$(gitPat)@dev.azure.com/happydump/projectEvaluations/_git/Pod4Source

          git clone https://$(gitUser):$(gitPat)@dev.azure.com/happydump/projectEvaluations/_git/Pod5Source


- task: CocoaPods@0
  inputs:
    forceRepoUpdate: false

$(gitUser)$(gitPat)都是出于凭据目的的管道机密。

Podfile:

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

source 'https://dev.azure.com/happydump/projectCore/_git/projectPodSpecsRepository'
source 'https://github.com/CocoaPods/Specs.git'

target 'projectDemo' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for projectDemo
  pod 'Pod1'
  pod 'Pod2'
  pod 'Pod3'
  pod 'Pod4'
  pod 'Pod5'

end

这是CocoaPods任务的日志:

##[section]Starting: CocoaPods
==============================================================================
Task         : CocoaPods
Description  : Install CocoaPods dependencies for Swift and Objective-C Cocoa projects
Version      : 0.151.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/cocoapods
==============================================================================
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod --version
1.7.1
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod install
[!] The version of CocoaPods used to generate the lockfile (1.7.3) is higher than the version of the current executable (1.7.1). Incompatibility issues may arise.
Analyzing dependencies
Adding spec repo `azure-happydump-projectcore-_git-projectpodspecsrepository` with CDN `https://dev.azure.com/happydump/projectCore/_git/projectPodSpec`
[!] Unable to add a source with url `https://dev.azure.com/happydump/projectCore/_git/projectPodSpec` named `azure-happydump-projectcore-_git-projectpodspecsrepository`.
You can try adding it manually in `/Users/vsts/.cocoapods/repos` or via `pod repo add`.
##[error]The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[error]The 'pod' command failed with error: The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[section]Finishing: CocoaPods

我点击了this链接到达了那里,但是窍门没有任何作用。

我似乎找不到找到解决办法的方法。感谢您的宝贵时间。

编辑:对yaml文件使用gem install cocoapods只会删除[!] The version of CocoaPods used to generate the lockfile (1.7.3) is higher than the version of the current executable (1.7.1). Incompatibility issues may arise.警告,但不能解决问题。

EDIT2:使用pod repo add azure-happydump-projectcore-_git-projectpodspecsrepository https://$(gitUser):$(gitPat)@dev.azure.com/happydump/projectCore/_git/projectPodSpecsRepository也无济于事。来自CocoaPods任务的错误消息将仅更改为... [!] Unable to add a source with url https://dev.azure.com/happydump/projectCore/_git/projectPodSpec named azure-happydump-projectcore-_git-projectpodspecsrepository-1. ...

1 个答案:

答案 0 :(得分:1)

问题是由于Podfile.lock文件中的url格式不同导致的:

Podfile: https://dev.azure.com/happydump/projectCore/_git/projectPodSpecsRepository

Podfile.lock https://happydump@visualstudio.com/DefaulCollection/projectCore/_git/projectPodSpecsRepository

从Podfile.lock还原url就成功了!