ios - devops Pipelines 中的私有 Cocopods 存储库
问题描述
使用 Azure Devops 和 iOS 对我来说是第一次。我正在尝试在 Azure devops 中为具有多个私有 cocoapods 存储库(PodXSource
)和一个私有规范存储库(projectPodSpecsRepository
)的 iOS 应用程序创建一个构建管道。
我似乎无法执行 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)
都是用于凭证目的的管道机密。
播客文件:
# 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
我按照此链接到达那里,但没有任何技巧。
我似乎无法找到一种方法来完成这项工作。谢谢你的时间。
编辑:使用gem install cocoapods
yaml 文件只会删除[!] 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. ...
解决方案
问题是由于 Podfile.lock 文件中的 url 格式差异造成的:
播客文件:
https://dev.azure.com/happydump/projectCore/_git/projectPodSpecsRepository
Podfile.lockhttps://happydump@visualstudio.com/DefaulCollection/projectCore/_git/projectPodSpecsRepository
从 Podfile.lock 恢复 url 就可以了!
以下是最终文件:
管道:请注意,我正在压缩 cocoapods 存储库,以免为每个构建克隆它们。
pool:
vmImage: 'macos-latest'
variables:
FILEEXISTS: false
steps:
- task: CmdLine@2
inputs:
script: 'sudo gem install cocoapods'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: 'Write-Host "##vso[task.setvariable variable=CP_HOME_DIR;]$(System.DefaultWorkingDirectory)/Cache"'
- task: CacheBeta@0
inputs:
key: PodReposTestZip | $(Agent.OS) | $(System.DefaultWorkingDirectory)/Konectom/Podfile.lock
path: $(System.DefaultWorkingDirectory)/Cache/tmp/
displayName: Cache Podfiles packages
- bash: |
if [ -d $(System.DefaultWorkingDirectory)/Cache/tmp ]; then
echo "##vso[task.setVariable variable=FILEEXISTS]true"
fi
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(System.DefaultWorkingDirectory)/Cache/tmp/cocoapods.zip'
destinationFolder: '$(System.DefaultWorkingDirectory)/Cache/repos'
cleanDestinationFolder: true
condition: eq(variables.FILEEXISTS, 'true')
- task: CmdLine@2
inputs:
script: 'pod repo add azure-company-project-_git-specrepository-ios https://$(gitUser):$(gitPat)@dev.azure.com/company/project/_git/repo'
- task: CocoaPods@0
inputs:
forceRepoUpdate: false
workingDirectory: 'AppDir'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'Certificats.p12'
certPwd: '$(certifPwd)'
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'ProvisionFile.mobileprovision'
- task: Xcode@5
inputs:
actions: 'build'
scheme: 'Konectom-dev'
sdk: "iphoneos13.0"
xcodeVersion: 'specifyPath'
xcodeDeveloperDir: '/Applications/Xcode_11.app'
configuration: 'Release'
xcWorkspacePath: 'Konectom/Konectom.xcworkspace'
packageApp: true
signingOption: manual
signingIdentity: $(APPLE_CERTIFICATE_SIGNING_IDENTITY)
provisioningProfileUuid: $(APPLE_PROV_PROFILE_UUID)
exportPath: $(build.artifactstagingdirectory)/pkgApp
- task: CmdLine@2
inputs:
script: 'ls -la $(build.artifactstagingdirectory)/pkgApp'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/Cache/repos/cocoapods'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(System.DefaultWorkingDirectory)/Cache/tmp/cocoapods.zip'
replaceExistingArchive: true
condition: eq(variables.FILEEXISTS, 'false')
- task: AppCenterDistribute@3
inputs:
serverEndpoint: 'AppCenterEndpoint'
appSlug: 'TestProject/TestApp'
appFile: $(build.artifactstagingdirectory)/pkgApp/App.ipa
releaseNotesOption: 'input'
releaseNotesInput: ''
destinationType: 'groups'
symbolsOption: Apple
播客文件:
workspace 'Project'
#
# Sources reposotiries
#
source 'https://dev.azure.com/company/project/_git/PodSpecsRepository'
source 'https://github.com/CocoaPods/Specs.git'
# Global project platform
platform :ios, '10.0'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
#
# Pods groups
#
def module0
pod 'po1', '~> 0.1.87'
pod 'pod2', '~> 0.1.29'
pod 'pod3', '~> 0.1.20'
pod 'pod4', '~> 0.1.13'
pod 'pod5', '~> 0.1.15'
pod 'pod6', '~> 0.1.15'
pod 'pod7', '~> 0.1.18'
pod 'pod8', '~> 0.1.10'
end
def Module1
pod 'pod1', '~> 0.1.20'
end
def module2
pod 'pod2', '~> 0.1.16'
end
def module3
pod 'pod3', '~> 0.1.6'
end
def module4
pod 'pod4', '~> 0.1.0'
end
def module5
pod 'pod5', '~> 0.1.8'
end
def module6
pod 'pod6'
end
#
# Main app target
#
target 'MainProject' do
project 'MainProject'
# Private Pods for Project
privateRepo1
privateRepo2
privateRepo3
privateRepo4
privateRepo5
privateRepo6
# Third party pods
pod 'SlideMenuControllerSwift', '~> 4.0'
pod 'SPPermissions/Camera'
pod 'SPPermissions/Location'
pod 'SPPermissions/Notification'
pod 'SPPermissions/Motion'
target 'TestsProject' do
inherit! :search_paths
# Pods for testing
end
target 'UiTestsProject' do
inherit! :search_paths
# Pods for testing
end
# Post install routine
post_install do |installer|
installer.pods_project.targets.each do |target|
# force swift version 4.0 for these pods
if target.name == ‘SlideMenuControllerSwift’
target.build_configurations.each do |config|
config.build_settings[‘SWIFT_VERSION’] = ‘4.0’
end
end
target.build_configurations.each do |config|
config.build_settings[‘EXPANDED_CODE_SIGN_IDENTITY’] = “”
config.build_settings[‘CODE_SIGNING_REQUIRED’] = “NO”
config.build_settings[‘CODE_SIGNING_ALLOWED’] = “NO”
end
end
end
end
Podfile.lock:
PODS:
- pod1(0.1.29):
- Kronos (~> 4.0.0)
- pod2(0.1.20)
- Alamofire (5.0.0-rc.3)
- pod3(0.1.32):
- pod2(~> 0.1.20)
- pod1(~> 0.1.29)
- lottie-ios (~> 2.5.0)
- Kronos (4.0.0)
- lottie-ios (2.5.3)
- SlideMenuControllerSwift (4.0.0)
- SPPermissions/Camera (4.1.4):
- SPPermissions/Core
- SPPermissions/Core (4.1.4)
- SPPermissions/Location (4.1.4):
- SPPermissions/Core
- SPPermissions/Motion (4.1.4):
- SPPermissions/Core
- SPPermissions/Notification (4.1.4):
- SPPermissions/Core
DEPENDENCIES:
- pod1(~> 0.1.20)
- pod2(~> 0.1.10)
- pod3(~> 0.1.15)
- pod4(~> 0.1.29)
- pod5(~> 0.1.0)
- SlideMenuControllerSwift (~> 4.0)
- SPPermissions/Camera
- SPPermissions/Location
- SPPermissions/Motion
- SPPermissions/Notification
SPEC REPOS:
https://dev.azure.com/company/project/_git/PodSpecsRepository:
- pod1
- pod2
- pod3
- pod4
- pod5
https://github.com/CocoaPods/Specs.git:
- Alamofire
- AppCenter
- GzipSwift
- KDCircularProgress
- Kronos
- lottie-ios
- SlideMenuControllerSwift
- SPPermissions
- SwiftKeychainWrapper
SPEC CHECKSUMS:
checksums
PODFILE CHECKSUM: checksum
COCOAPODS: 1.8.4
推荐阅读
- c++ - 为 QFileDialog 设置默认的 UNC 路径
- java - 如何在Android上的webView中显示特定文件夹中的html文件
- r - 数据帧 R 中的观测值和变量数不相等
- python - 为什么 predict_proba 函数在朴素贝叶斯中的总和不等于 1
- reactjs - 从每个 url 和刷新时重定向到主页
- c++ - 返回 0 之前的预期不合格 id
- unreal-engine4 - 当我在游戏或编辑器中移动相机时,顶点之间会产生额外的边缘
- python - 将 numpy int 转换为 matlab int
- python - 错误“预期的字符串或类似字节的对象错误”
- apache-kafka - __consumer_offsets 主题越来越大