mda*_*y77 7 yaml azure-devops azure-pipelines
我正在尝试在天蓝色管道中运行 cypress 测试。为此,我需要在运行测试之前运行“dotnet run”。我有一个管道任务成功运行“dotnet run”命令,但因为它永远不会退出,所以管道永远不会进入下一个任务。有没有办法使用 YAML 使管道作业进入下一步,同时保持“dotnet run”命令运行?
如果这不可能,是否有办法在 Azure 管道中运行 cypress 测试时在后台运行“dotnet run”?
这是我的 YAML 代码的一部分:
- task: DotNetCoreCLI@2
displayName: 'dotnet run'
inputs:
command: run
projects: Api/Api.csproj
arguments: '--configuration Release --verbosity normal'
- script: 'npx cypress verify' // pipeline job never gets to this step
displayName: 'Verify Cypress Can Run'
failOnStderr: true
Run Code Online (Sandbox Code Playgroud)
我想出了一个解决方案。我将“dotnet run”放入作为后台进程运行的 powershell 脚本中。
powershell脚本:
Start-Process powershell -ArgumentList "-NoProfile", "-NonInteractive", "-NoExit", {
dotnet run
}
Run Code Online (Sandbox Code Playgroud)
然后我在 powershell 构建步骤中运行 powershell 脚本:
- task: PowerShell@2
inputs:
targetType: 'filePath' # Optional. Options: filePath, inline
filePath: $(Build.SourcesDirectory)\Api\dotnetrun.ps1
errorActionPreference: 'stop'
failOnStderr: false # Optional
workingDirectory: ./Api
displayName: 'Run dotnet run as background process'
Run Code Online (Sandbox Code Playgroud)
构建步骤运行并根据需要进入下一步。
| 归档时间: |
|
| 查看次数: |
4446 次 |
| 最近记录: |