如何始终在Jenkins中运行构建步骤并忽略失败 [英] How to always run a build step in Jenkins and ignore failure

查看:646
本文介绍了如何始终在Jenkins中运行构建步骤并忽略失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 sdk- manager-plugin 下载我的Android依赖项.不幸的是,由于首次下载"问题,我的Jenkins CI构建经常失败(#47 #10 ).

I use the sdk-manager-plugin to download my Android dependencies. Unfortunately my Jenkins CI build frequently fails due to "first time download" issues (#47 #10).

我听说人们通过两次构建代码来解决此问题,因此,如果第一次失败,则第二次通过.

I've heard that people workaround this by building their code twice, so that if it fails on the first time then it will pass on the second time.

我们尝试使用条件步骤(如下屏幕截图)在Jenkins中进行设置,但是如果第一步失败,它仍然会导致整个CI作业失败.

We've tried to set this up in Jenkins using a conditional step (screenshot below), but if the first step fails it still causes the whole CI job to fail.

有人可以推荐最好的方法进行设置吗?

Can anybody recommend the best way to set this up?

推荐答案

解决方法最简单的方法是运行执行外壳"步骤以进行增量SDK更新,以确保Android SDK组件正常运行到目前为止.

The simplest way I've found to workaround this is to run an "Execute shell" step to do an incremental SDK update to ensure the Android SDK components are up to date.

这是构建步骤的我的Jenkins CI配置:

Here's my Jenkins CI config for the build steps:

这是命令:

(for i in {1..30}; do echo y; sleep 1; done) | /opt/android/android-sdk-linux/tools/android update sdk --all --no-ui --filter \    
extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository    

对我的环境的一个微妙之处(我目前正在使用CloudBees在Cloud中使用Jenkins):我需要确保我没有更新platform-tooltool组件,因为这导致我的构建频繁变为不稳定而失败.我正在运行一个Google Inc.:Google APIs:18模拟器,对我来说,它比更新的模拟器更稳定.

One subtlety for my environment (I'm currently using Jenkins in the cloud, using CloudBees): I needed to make sure I did not update the platform-tool or tool components, as that caused my builds to frequently become unstable and fail. I'm running a Google Inc.:Google APIs:18 emulator, which has seemed a lot more stable for me than newer ones.

这篇关于如何始终在Jenkins中运行构建步骤并忽略失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆