azure - failOnStderr: true 时的 Azure 脚本任务,出现非没有此标志的 bash 错误
问题描述
当failOnStderr:true未在任务中设置时,我有有线行为一切正常但是
当我使用failOnStderr调用这样的脚本任务时:true:
- script: |
echo 'Start invoking Fastfile'
fastlane release --verbose projectName:${{parameters.projectName}} appIdentifier:${{parameters.appIdentifier}} versionNumber:${{parameters.versionNumber}} buildNumber:${{parameters.buildNumber}} plistFileFtpBasePath:${{parameters.plistFileFtpBasePath}} ArtifactsDirectory:$(System.ArtifactsDirectory)
echo 'Done invoking Fastfile'
failOnStderr: true
workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
displayName: 'create keychain invoke fastlane'
我收到此错误:
2020-09-30T07:54:45.8179430Z INFO [2020-09-30 07:54:45.81]: [32mfastlane.tools finished successfully 🎉[0m
2020-09-30T07:54:45.8917310Z Done invoking Fastfile
2020-09-30T07:54:45.8948720Z
2020-09-30T07:54:45.9020160Z ##[error]Bash wrote one or more lines to the standard error stream.
2020-09-30T07:54:45.9033610Z ##[error]/Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.161.0/fastlane_core/lib/fastlane_core/ui/interface.rb:141: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.161.0/fastlane_core/lib/fastlane_core/ui/errors/fastlane_error.rb:9: warning: The called method `initialize' is defined here
2020-09-30T07:54:45.9035550Z ##[error]security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
2020-09-30T07:54:45.9037370Z ##[error]/Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.161.0/gym/lib/gym/generators/package_command_generator_xcode7.rb:154: warning: URI.escape is obsolete
2020-09-30T07:54:45.9040080Z ##[error]/Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.161.0/gym/lib/gym/generators/package_command_generator_xcode7.rb:155: warning: URI.escape is obsolete
/Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.161.0/gym/lib/gym/generators/package_command_generator_xcode7.rb:156: warning: URI.escape is obsolete
2020-09-30T07:54:45.9042740Z ##[error]warning: /Users/runner/Library/Developer/Xcode/Archives/2020-09-30/xxxx_2019.1.4.xxxx-xxxx.1.1.0.4_SPRINT_14 2020-09-30 07.51.27.xcarchive/BCSymbolMaps/1BD5CB31-31FC-328B-A827-73EA51BB6041.bcsymbolmap: No such file or directory: not unobfuscating.
2020-09-30T07:54:45.9045210Z ##[error]warning: /Users/runner/Library/Developer/Xcode/Archives/2020-09-30/xxxx_1.1.xxxx-xxxx.1.1.0.4_SPRINT_14 2020-09-30 07.51.27.xcarchive/BCSymbolMaps/9FCBA8ED-D8FD-3C16-9740-5E2A31F3E959.bcsymbolmap: No such file or directory: not unobfuscating.
2020-09-30T07:54:45.9047670Z ##[error]warning: /Users/runner/Library/Developer/Xcode/Archives/2020-09-30/xxxx_1.1.xxxx-xxxx.1.1.0.4_SPRINT_14 2020-09-30 07.51.27.xcarchive/BCSymbolMaps/999C2967-8A06-3CD5-82D7-D156E9440A0C.bcsymbolmap: No such file or directory: not unobfuscating.
2020-09-30T07:54:45.9050110Z ##[error]warning: /Users/runner/Library/Developer/Xcode/Archives/2020-09-30/xxxx_1.1.xxxx-xxxx.1.1.0.4_SPRINT_14 2020-09-30 07.51.27.xcarchive/BCSymbolMaps/EB7DF7BE-351D-3A4A-949C-0AE12606A3E2.bcsymbolmap: No such file or directory: not unobfuscating.
2020-09-30T07:54:45.9052570Z ##[error]warning: /Users/runner/Library/Developer/Xcode/Archives/2020-09-30/xxxx_1.1.xxxx-xxxx.1.1.0.4_SPRINT_14 2020-09-30 07.51.27.xcarchive/BCSymbolMaps/9702769F-1F06-3001-AB75-5AD38E1F7D66.bcsymbolmap: No such file or directory: not unobfuscating.
2020-09-30T07:54:45.9055030Z ##[error]warning: /Users/runner/Library/Developer/Xcode/Archives/2020-09-30/xxxx_1.1.xxxx-xxxx.1.1.0.4_SPRINT_14 2020-09-30 07.51.27.xcarchive/BCSymbolMaps/D560471D-F43F-30D6-9717-5252EE100F10.bcsymbolmap: No such file or directory: not unobfuscating.
2020-09-30T07:54:45.9056620Z ##[error]Additional writes to stderr truncated
2020-09-30T07:54:45.9063410Z ##[section]Finishing: create keychain invoke fastlane
设置为 false 时更新 仍然不起作用
- script: |
echo 'Start invoking Fastfile'
fastlane release --verbose projectName:${{parameters.projectName}} appIdentifier:${{parameters.appIdentifier}} versionNumber:${{parameters.versionNumber}} buildNumber:${{parameters.buildNumber}} plistFileFtpBasePath:${{parameters.plistFileFtpBasePath}} ArtifactsDirectory:$(System.ArtifactsDirectory)
echo 'Done invoking Fastfile'
failOnStderr: false
workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
displayName: 'create keychain invoke fastlane'
解决方案
这是预期的行为。
设置后,如果将任何错误写入StandardError流,failOnStderr: true
则任务将失败。
相反,如果failOnStderr
是false
,任务的失败将取决于退出代码。退出代码不为0时,任务将失败。
正常情况下,您应该知道将错误写入stderr不会导致退出代码为非零。failOnStderr
是true
或是false
两种不同的失效条件。
根据您分享的日志:
2020-09-30T07:54:45.9020160Z ##[error]Bash wrote one or more lines to the standard error stream.
您可以看到有一些错误写入Stderr流。此时,由于您设置failOnStderr
为,任务按预期失败true
。
更新:
样本:
成功并发出警告:
使用标准错误失败:
推荐阅读
- node.js - forEach 中的 Promise
- python-3.x - Python:用 pip3 安装了一个本地包,但没有找到模块错误
- c# - 启动 ConfigureServices AddMvc() 中的 KeyNotFoundException
- java - GetObjectField() 是否返回本地引用?
- php - 不要为方法实例化服务传递控制器
- javascript - 单击时修改元素
- monetdb - MonetDB 插入错误的数据
- ffmpeg - 使用 FFMPEG 从图像生成 2-fps mp4
- javascript - Vue 是否有与 Angular ui-router 相同的路由器?
- javascript - 在 node.js 中使用 es6 import 而不是 require