Disclaimer: I was not able to serve in the military.
In this case it looks kind of like both. It seems like it's a ritual that's done during / near the end of some kind of period of training where there is a "graduation" or other accomplishment.
Every military has it's culture. And, where drill, exercise, adventure and frolic can be combined into one, the activity or event can have meaning as well as being a "release" for both participants and spectators.
Here is another example of a "graduation" ritual which also requires many dimensions of fitness, teamwork, leadership, and with a healthy dose of fun...The Herndon Monument climb at the U.S. Naval Academy.