【问题标题】:Install new versions of dependencies on Azure devops microsoft hosted build server在 Azure devops microsoft 托管构建服务器上安装新版本的依赖项
【发布时间】:2021-02-22 22:15:01
【问题描述】:
我在 iOS 中的 Xamarin 移动应用程序的 azure 构建管道存在问题。该问题需要在构建服务器上提供单声道版本 6.10.0。目前 macOS 10.14 的预安装映像仅包含最高版本 6.08 的 Mono。 macOS 10.15 的映像确实包含正确版本的 Mono,但由于内部原因,我目前无法升级到 10.15。
有没有办法在构建之前更新管道以安装新版本的 Mono?还是我们完全局限于图像中包含的软件?我正在使用微软托管的服务器。
【问题讨论】:
标签:
xamarin
azure-devops
azure-pipelines
release-management
【解决方案1】:
有没有办法在构建之前更新管道以安装新版本的 Mono?
如您所说,Microsoft-Hosted Agent: Macos-10.14 中不存在 Mono 版本 6.10.0,但您可以在 Xamarin 任务之前运行脚本来安装目标 Mono版本。
这是管道示例:
steps:
- bash: |
#!/bin/bash
set -ex
MONO_MACOS_PKG_DOWNLOAD_URL='https://download.mono-project.com/archive/6.10.0/macos-10-universal/MonoFramework-MDK-6.10.0.49.macos10.xamarin.universal.pkg'
mkdir -p /tmp/mono-install
cd /tmp/mono-install
# debug: mono version before the install
mono --version
# download mono mac installer (pkg)
wget -q -O ./mono-installer.pkg "$MONO_MACOS_PKG_DOWNLOAD_URL"
# install it
sudo installer -pkg ./mono-installer.pkg -target /
# debug: mono version after install, just to confirm it did overwrite the original version
mono --version
# just for fun print this symlink too, which should point to the version we just installed
ls -alh /Library/Frameworks/Mono.framework/Versions/Current
displayName: 'Bash Script'
- script: |
mono -V
cat `which mcs`
displayName: 'Command Line Script'
这里是a Blog关于安装单声道。
结果:
【解决方案2】:
Azure Pipelines 托管代理是通用的构建和部署代理。因此,Microsoft 不会添加任何人可能需要的旧版本软件来解决边缘情况。
但是,您确实可以使用自制软件和其他工具,这些工具可以让您在代理上安装所需的软件。您还可以访问设置环境变量。所以你可以安装所有需要的软件。
至于保持在 macOS 10.14 和您需要的任何版本的单声道的要求。在某些时候,您必须意识到 Microsoft 提供的图像中没有包含任何此类软件。因此,如果您必须拥有此环境,请制作您自己的托管 macOS 代理并添加到您的池中以在其上运行类似的东西。