Mic*_*l B 6 azure azure-devops
我的 azure-pipelines.yml 中有以下内容
jobs:
- job: TestifFolder1Exists
pool:
vmImage: 'ubuntu-16.04'
steps:
- bash: git log -1 --name-only | grep -c Folder1
failOnStderr: false
- job: Folder1DoesntExist
pool:
vmImage: 'ubuntu-16.04'
dependsOn: TestifFolder1Exists
condition: failed()
- job: Folder1DoesExist
pool:
vmImage: 'ubuntu-16.04'
dependsOn: TestifFolder1Exists
condition: succeeded()
Run Code Online (Sandbox Code Playgroud)
我正在尝试测试文件夹是否进行了更改,以便我可以从该目录发布工件。
我遇到的问题是,如果没有任何内容写入文件夹,脚本将失败
Bash exited with code '1'.(这是我想要的),这反过来会使整个构建失败。
如果我添加,continueOnError则以下作业始终运行成功的作业。
我怎样才能让这项工作失败,而不会使整个构建失败?
有一个选项叫做continueOnError。默认设置为 false。将此更改为 true,您的任务不会停止构建作业。
我不知道如何忽略失败的工作,但这就是我解决这个特定问题的方法
jobs:
- job: TestifFolder1Exists
pool:
vmImage: 'ubuntu-16.04'
steps:
- bash: |
if [ "$(git log -1 --name-only | grep -c Folder1)" -eq 1 ]; then
echo "##vso[task.setVariable variable=Folder1Changed]true"
fi
- bash: echo succeeded
displayName: Perform some task
condition: eq(variables.Folder1Changed, 'true')
Run Code Online (Sandbox Code Playgroud)
(虽然事实证明 Azure Devops 已经完成了我在这里尝试创建的内容 - 路径过滤器触发!)
| 归档时间: |
|
| 查看次数: |
10391 次 |
| 最近记录: |