Last active
February 9, 2022 10:47
-
-
Save smartgammadev/790df34fbc52c481c03df8d99f8ae37d to your computer and use it in GitHub Desktop.
Smart Gamma CI script that allows to collect all failed Behat tests executed in multithreading mode at Jenkins console output log and pass it to behat for restart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$logFilename = getenv('JENKINS_HOME') . '/'. str_replace(getenv('JENKINS_URL'), '', getenv('JOB_URL')); | |
$logFilename = str_replace('/job/', '/jobs/', $logFilename) . 'builds/'. getenv('BUILD_NUMBER') . '/log'; | |
$text = file_get_contents($logFilename); | |
preg_match_all('/Failed scenarios:(.*?)\d+\sscenario/is', $text, $m); | |
list($original, $threads) = $m; | |
$features = []; | |
foreach($threads as $thread) { | |
$features = array_filter(explode("\n",$thread)); | |
foreach($features as $feature) { | |
echo trim($feature) . "\n"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where we have to save this file. Can u plz tell