我已经看到了Jenkins: archiveArtifacts - multiple distinct files和Jenkins multiple artifacts for the same build的答案,我也看了文档(来自https://stackoverflow.com/a/50022804/264822),但没有一个解释如何将一长行文件拆分为多行(以提高可读性?)
一个简短的例子是:
archiveArtifacts artifacts: 'build_wrapper_output_directory/build-wrapper-dump.json, build_wrapper_output_directory/build-wrapper.log'
如果我尝试拆分这一行,Jenkinsfile的解析就会失败。使用单引号拆分:
archiveArtifacts artifacts: 'build_wrapper_output_directory/build-wrapper-dump.json,'
'build_wrapper_output_directory/build-wrapper.log'
给了我:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 116: unexpected token
在不带引号的情况下拆分时:
archiveArtifacts artifacts: 'build_wrapper_output_directory/build-wrapper-dump.json,
build_wrapper_output_directory/build-wrapper.log'
给了我:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 112: expecting ''', found '\n' @ line 112, column 75.
1条答案
按热度按时间vvppvyoh1#
使用
\
工作: