How to exit pipeline in after_script?

I want to exit my pipeline in after_script , pipeline should fail . Everything should happen in one job only. Please suggest solutions...