1build icon indicating copy to clipboard operation
1build copied to clipboard

Execute 'after' phase irrespective of the commands success/failure

Open akhilbojedla opened this issue 5 years ago • 6 comments

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.

akhilbojedla avatar Sep 27 '19 19:09 akhilbojedla

@landpro WDYT?

gopinath-langote avatar Sep 30 '19 14:09 gopinath-langote

@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 avatar Sep 30 '19 14:09 gopinath-langote

@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.

akhilbojedla avatar Oct 01 '19 15:10 akhilbojedla

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.

boonwj avatar Oct 04 '19 10:10 boonwj

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 avatar Jan 29 '20 11:01 gopinath-langote

@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.

akhilbojedla avatar May 17 '20 14:05 akhilbojedla