我有一个构建流程,按顺序构建4个作业
例如;
build(Job 1)
build(Job 2)
build(Job 3)
build(Job 4)
我想运行Job 4,即使上一个任务也失败了。我怎样才能在构建流程中做到这一点?
答案 0 :(得分:5)
您可以将传播设置为false,这将确保在特定作业失败时您的工作流程将继续:
build job: '<job_name>', propagate: false
答案 1 :(得分:0)
您可以按如下方式使用Jenkins Workflow Plugin:
try {
build 'A'
} catch(e) {
echo 'Build for job A failed'
}
try {
build 'B'
} catch(e) {
echo 'Build for job B failed'
}
您可以将此习语扩展为任意数量的作业或您想要的任何成功/失败流程的组合(例如,如果您想要建立一些工作,请在build
内添加catch
步骤另一个失败了。)
答案 2 :(得分:0)
对我来说, <?php
set_time_limit(0); //THIS SCRIPT JUST INITIALS THE PROFILE TO BE RUN VIA MAGENTO ADMIN "RUN PROFILE IN POPUP". Its the same thing as click just via this file that you can run via cron
$profileId = 1; // SYSTEM - IMPORT/EXPORT - DATAFLOW PROFILES PROFILES <-- you need to go into your magento admin and grab the exact profile ID
require_once 'app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$sku = 10; //this sku you get it from your text box.
$_product = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect(array(
'name',
'sku',
'price',
'thumbnail'
))->addAttributeToFilter('status', 1)->addAttributeToFilter('sku', array(
'in' => $sku
));
$imageHelper = Mage::helper('catalog/image');
foreach($_product as $prod)
{
$name = $prod->getName();
$price = $prod->getPrice();
$thumbnail = $imageHelper->init($prod, 'thumbnail')->resize(150, 220);
}
echo "Name: ", $name;
echo "<br />";
echo "Sku: ", $sku;
echo "<br />";
echo "Price: ", $price;
echo "<br />";
echo "Image: ", $thumbnail; ?>
没有用,所以我在BuildFlow中使用propagate: false
来确保流中的所有作业都执行,即使有失败。 (Ref)
ignore(FAILURE)