1build
1build copied to clipboard
Execute 'after' phase irrespective of the commands success/failure
Description
In most cases After
phase needs to be executed irrespective of whether the commands
are executed successfully or not.
For example unset an environment variable (or) cleaning up connections irrespective of the status of execution.
Acceptance Criteria
After
phase should be executed irrespective of the status of execution of commands.
@landpro WDYT?
@akhilbojedla Good point – let's also get some feedback from others
IMHO, stopping build makes more sense - we are not sure for what purpose before is getting used.
We can give a parameter/flag to do it - by default fail and do not continue.
@gopinath-langote I think otherwise. Generally before
and after
are used as setting up and cleanup (atleast it is in the most cases I know).
For example popular testing frameworks like Junit
executes the methods annotated with @AfterEach
, @AferAll
irrespective of tests success/failure.
Perhaps this could be controlled via a field, e.g. execute_after_on_failure: false
. The user can then have a choice on their preferred behaviour.
Hello @akhilbojedla I agree with @boonwj
It make sense to parameterise the option to the user. Now there are two ways to do it.
Either pass the exec_after_failure
in command line or give this as an option in yaml
config itself.
WDYT?
@gopinath-langote Firstly, Apologies for the late reply.
Yes, I think that could be an option. I would personally prefer to do it the other way around though i.e. disabling executing after
phase via command-line option and enable it by default. But any option works just fine for me.