Triggering a pipeline and waiting for it to finish after running pipeline

How can i trigger the pipeline one after other.
If any commit happen the pipeline gets trigger and another commit another pipeline gets triggered, so i want to keep the second one in queue and to start it once the first pipeline gets completed.

Please suggest how to configure.