This like you don't want to talk about it before script and after script configuration that you can
do in catalepsy now, starting with before script, before script is often used to define a command
that should run before the main script runs.
Now, you can define it at the global level or you can define it as the job level.
Overriding the default configuration, the global configuration that you have, for example, that we
can do is to add here and not before deploy production.
You can add your own before script.
And they call applying to production.
Now, this will be executed before the main block script is executed.
Why would you want to do that?
You are not forced to use it.
You can use it.
If you find a scenario where running either a script globally before the script is being executed makes
sense, or if you have something globally and you need to override it, that would be a possibility
as well.
What you will often seen some configurations, if you are looking at configurations that others have
written for Forget Besigye, is that they install any dependencies that are needed for the specific
job in the before script block.
So, for example, in this case, we are installing Serj because we want to deploy something with search.
Now, of course, this entire script blocker isn't that big, but sometimes the tools that need to be
installed in order to run something can occupy a few lines.
And what you can use before script is to make a separation between what is the actual script about.
So, for example, in this case, we are simply deploying this project.
So this is like the main functionality and the rest of it.
For example, this installation, this is only need for this Destrehan.
So what we can do is that we can move it to before script.
And now if you look at the main script, it's simply script to call it that way, you can easily say,
OK, in this step, this is what is being done.
And the script is just like the set up in order to make everything work.
And this can make your entire pipeline configuration easier to read.
Now, if you want to use it or not, this is totally up to you.
I just wanted to present you before this is something that you will see more often if the script runs
a bit differently because the working directory will be set to default.
And a context where the script around is totally different from before script and the script blocks.
And for that reason, they have nothing to an example but all the documentation.
And just to keep this in mind, before script after script exists, if you ever have the need of using
them, feel free to check the configuration.
It's much better.
And for the rest of the scenario, we'll leave this as it is.
So I'm going to reverse these changes and we'll leave everything in the script and will not use before
script.