有没有办法更改构建管道的超时时间,目前管道时间在 60 分钟后结束。我想把它减少到 30 分钟。
我查看了所有组织设置和项目设置,但在 UI 上找不到任何内容
或者它可以从 YAML 设置吗?
在我们的 Azure Pipelines 管道中,我们有采用 InlineData 参数的 .NET Core xUnit 测试方法。测试运行程序运行所有测试方法,并在其控制台输出中正确报告每个 InlineData 实例作为测试运行。但是,Azure Pipelines 报告的测试计数较低,因为它将 [Theory] 测试计为一项测试(而不是对每个 InlineData 实例进行一项测试)。
如何使 Azure Pipelines 将 InlineData 的所有实例报告为测试?
作为示例,这是一个作业输出。
测试作业报告 9 个测试。9 个测试包括两个 [Theory] 方法,每个方法都有两个 InlineData:
Azure Pipelines 仅报告 7 个测试,而不是预期的 9 个测试:
我尝试使用or表达式在模板上定义布尔值,如下所示:
parameters:
- name: A
default: true
- name: B
default: false
stages:
- template: bacon.yml@template
parameters:
booleanParameter: or(eq(${{ parameters.A }}, true), eq(${{ parameters.B}}, true))
Run Code Online (Sandbox Code Playgroud)
在我看来,它应该工作得很好,但我不断收到同样的错误:
The 'booleanParameter' parameter value 'or(eq(True, true), eq(False, true))' is not a valid Boolean.
Run Code Online (Sandbox Code Playgroud)
我尝试了一些语法的小变化,所有这些都会导致相同的错误。
我在这里缺少什么?
更新:
是否可以添加或更改在 Azure DevOps 上执行管道的命令?
在Visual Studio Code上本地运行我的程序,我确实得到了输出。
但是,在Azure DevOps上运行我的GitHub原始分支不会产生任何输出。
我遵循了 Stack Overflow 的答案,该答案引用了GitHub 问题的解决方案。
我已经实现了以下内容,但 Azure 的原始日志在我的 Python 上返回空白logging。
test_logging.py:
import logging
filename = "my.log"
global logger
logger = logging.getLogger()
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
open(filename, "w").close() # empty logs
fileHandler = logging.FileHandler(filename)
fileHandler.setFormatter(formatter)
fileHandler.setLevel(logging.INFO)
logger.addHandler(fileHandler)
logger.error('TEST')
# fetch logs
with open(filename, "r") as fileHandler:
logs = [log.rstrip() for log in …Run Code Online (Sandbox Code Playgroud) 我们拥有适用于 iOS 和 UWP 项目的 Xamarin.Forms 解决方案。我们使用 Azure 管道来构建 iOS 项目。直到昨天一切都工作正常。现在,构建在 NuGet Restore 步骤失败,并出现错误:
##[错误]nuget 命令失败,退出代码(1) 和错误(/Users/runner/work/1/s/"MyProjectName.UWP".csproj :错误 MSB4057:目标“_IsProjectRestoreSupported”不存在于项目。
我们可以看到,尝试在 Mac OS 构建主机上恢复 UWP 项目的 NuGet 包时会出现问题。图片:macOS-11
解决方法是将其从解决方案中排除,但我们将其用于测试目的,这对我们来说不是一个好的选择。
我在自托管代理上有一个 Azure Pipeline我使用此任务
- task: AzureCLI@2
displayName: Azure CLI task with Python SDK
inputs:
azureSubscription: 'SUBSCRIPTION-SERVICE-CONNECTION'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
python ./magic-script.py
Run Code Online (Sandbox Code Playgroud)
这样我就可以使用凭据来验证Azure Python SDK:
client = get_client_from_cli_profile(GraphRbacManagementClient)
Run Code Online (Sandbox Code Playgroud)
当我将此过程转移到MS 托管代理时,我收到此错误:
File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/azure/common/client_factory.py", line 85, in get_client_from_cli_profile
with_tenant=True,
File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/azure/common/credentials.py", line 98, in get_azure_cli_credentials
cred, subscription_id, tenant_id = profile.get_login_credentials(resource=resource)
File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/azure/cli/core/_profile.py", line 335, in get_login_credentials
credential = self._create_credential(account, client_id=client_id)
File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/azure/cli/core/_profile.py", line 592, in _create_credential
return identity.get_service_principal_credential(username_or_sp_id)
File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/azure/cli/core/auth/identity.py", line 185, in get_service_principal_credential
entry …Run Code Online (Sandbox Code Playgroud) 最近正在研究 Azure DevOps 模板。并遇到了这种双花括号语法。只是想知道如何在 Azure DevOps 中使用双花括号。
看过一些关于相同内容的帖子。
可以说,我在组中定义了一个变量,如下所示。
我们还可以在 yaml 文件中定义变量,如下所示。
variables:
- name: BuildConfiguration
value: 'Release'
- name: finalBuildArtifactName
value: 'TempFolderName'
Run Code Online (Sandbox Code Playgroud)
什么时候应该使用双大括号语法?
我有关于并使用以下方法来引用变量的想法。
与上述两个相比,我们可以用双花括号完成什么?
让 yaml 管道中的东西正常工作非常困难。进行更改、签入、运行管道、查看结果并再次返回。这非常耗时,而且至少可以说并不顺利。
在我的管道中,我有一项任务(除其他外)要么成功,要么成功但存在问题,由以下因素控制:
if (-Not $packagesAreUpToDate) {Write-Host "##vso[task.complete result=SucceededWithIssues;]"}
Run Code Online (Sandbox Code Playgroud)
此任务使整个作业(包含其他任务)具有“警告”状态,这是所期望的。
问题是在观察提交历史记录时,管道看起来好像失败了(当它们应该具有“警告”或类似状态时)。
有没有办法解决这个问题,或者这是 Azure DevOps 尚未添加的错误或功能?
从其 PAT 配置了自托管代理的用户即将离开组织。一旦用户离开组织,他的帐户将从 Azure AD 中删除,因此他的 PAT 将过期。应如何接管自托管代理或使用其他用户帐户更新 PAT?
我无法看到任何有关 PAT 更新的 MSFT 文档。在这种情况下,卸载并重新安装是唯一的选择吗?
我有一组 Azure 构建管道,用于编译 rust 项目,并且当前使用 blob 存储将.cargo和target文件夹存储为缓存。
在本地编译时,一旦第一次编译了二进制文件,后续的cargo build就不会再次编译依赖库/板条箱,而只是本地二进制文件,但是使用我当前的管道系统,在下载缓存并使用正确的目标文件夹后构建后,管道仍然下载并构建 crates。
这是我用于缓存和任何管道构建的 config.toml。
[build]
target-dir = "./target"
dep-info-basedir = "."
incremental = true
Run Code Online (Sandbox Code Playgroud)
在某些情况下,它减少了编译时间,但远没有我预期的那么多。我可以缓存更多文件夹以提高速度吗?是否存在货物正在检查并污染缓存的某些缓存标识符?
管道运行一个自定义的 xtask 二进制文件,该二进制文件执行许多任务,包括运行,cargo build --release这是否会导致问题?
azure-pipelines ×10
azure-devops ×6
.net-core ×1
azure ×1
caching ×1
logging ×1
python ×1
rust ×1
rust-cargo ×1
timeout ×1
xamarin.ios ×1
xunit ×1