【发布时间】:2018-01-23 12:18:11
【问题描述】:
我有一个 jenkins 作业,它在作业执行 shell 中配置了 5 个构建脚本。现在我在脚本#1 中有一个标志,如果它是假的,那么我不想运行剩余的 4 个构建脚本并直接退出然后构建结果应该通过。
但是现在即使在检查 script#1 标志为 false 之后,它也会从 script#1 退出并执行剩余的 4 个构建脚本,然后由于与 script#1 的依赖,所有 4 个脚本都失败了,最后我的 jenkins 构建状态失败。
我希望在检查脚本#1 作业后可以退出并直接 jenkins 作业状态应该是“通过”
jenkins 本身是否有控制此流程的方法?不用在脚本中编写任何代码?
詹金斯错误:
------------
23:37:16 Nothing to build
23:37:16 SRV_SKIP_UNNECESSARY_BUILDS is set to 1
23:37:16 Exiting now...
23:37:16 +++/usr/atria/bin/cleartool rmview -f -tag swrel_sre_icx_test_ashok_diffreportvu_20180118_233612
23:37:30 SRE_FYI: No rebuild necessary for sre_icx_test_ashok since previous full build[EnvInject] - Injecting environment variables from a build step.
23:37:30 [EnvInject] - [ERROR] - The given properties file path '/var/tmp/jenkins/workspace/Test/sre_icx_test_ashok/srv_env_strip' doesn't exist.
23:37:30 [EnvInject] - [ERROR] - Missing file path was resolved from pattern '${WORKSPACE}/srv_env_strip' .
23:37:30 [EnvInject] - [ERROR] - Problems occurs on injecting env vars as a build step: java.io.IOException: remote file operation failed: /var/tmp/jenkins/workspace/Test/sre_icx_test_ashok at hudson.remoting.Channel@1c0be696:l42-up-ecbld-01: java.io.IOException: The given properties file path '/var/tmp/jenkins/workspace/Test/sre_icx_test_ashok/srv_env_strip' doesn't exist.
23:37:30 Build step 'Inject environment variables' changed build result to FAILURE
23:37:30 Build step 'Inject environment variables' marked build as failure
23:37:30 Set build name.
23:37:30 Unrecognized macro 'SRV_BUILD_LABEL' in '#22 - ${SRV_BUILD_LABEL}'
23:37:30 Archiving artifacts
23:37:30 SSH: Current build result is [FAILURE], not going to run.
23:37:30 [description-setter] Description set: ${SRV_BUILD_DIR}
23:37:30 Notifying upstream projects of job completion
23:37:30 Finished: FAILURE
【问题讨论】: