相关疑难解决方法(0)

Azure Powershell - Az 模块不适用于 Ubuntu 托管的构建代理

我在 Ubuntu 16.04 托管的构建代理上有一个在 Azure DevOps 中运行的构建。我正在使用最新版本的“Azure Powershell”任务(版本 4.* 预览版),它应该是多平台的,支持 Powershell 核心,并支持使用Azure Powershell Az 模块

Azure Powershell 任务版本 4

但是,它并不完全有效。在运行我的任何脚本之前,它会出错:

##[section]Starting: Azure PowerShell script: InlineScript
==============================================================================
Task         : Azure PowerShell
Description  : Run a PowerShell script within an Azure environment
Version      : 4.0.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613749)
==============================================================================
##[warning]Can\'t find loc string for key: GeneratingScript
GeneratingScript
[command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/e66222aa-283d-4dfd-b5c1-f1d2a4a3ba9f.ps1'
Could not find the module Az.Accounts with given version. If the module was …
Run Code Online (Sandbox Code Playgroud)

azure-powershell azure-devops azure-devops-hosted-agent

2
推荐指数
1
解决办法
2833
查看次数

任务控制选项 - 自定义条件 - 在先前失败或超时时运行任务

是否有一个选项可以设置自定义条件来测试上一个任务是否失败或超时?

目前,我正在使用Only when a previous task has failed当任务失败时有效的方法。如果任务超时,则不会将其视为错误并会跳过。

那么我需要一个自定义条件,例如or(failed(), timedout()). 是否可以?

语境

我们的任务遇到了这个间歇性问题npm install,我们无法找到原因,但它在下一次作业运行时得到解决,因此我们正在寻找重试功能。部分解决方案是复制npm install并使用控制选项,但它不适用于所有“失败”情况。@Levi Lu-MSFT 提供的解决方案似乎可以满足我们所有的需求(它会重试),但遗憾的是它没有解决问题,第二行重复任务也失败了。

错误示例:

20741 error   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\agent2\\_work\\4\\s\\node_modules\\.staging\\typescript-4440ace9\\lib\\tsc.js\'',
20741 error   errno: -4048,
20741 error   code: 'EPERM',
20741 error   syscall: 'unlink',
20741 error   path: 'C:\\agent2\\_work\\4\\s\\node_modules\\.staging\\typescript-4440ace9\\lib\\tsc.js',
20741 error   parent: 's' }
20742 error The operation was rejected by your operating system.
20742 error It's possible that the file was already in use (by a …
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines azure-pipelines-tasks azure-pipelines-yaml

2
推荐指数
1
解决办法
5347
查看次数