1
00:00:02,370 --> 00:00:07,290
This like you don't want to talk about it before script and after script configuration that you can

2
00:00:07,290 --> 00:00:14,880
do in catalepsy now, starting with before script, before script is often used to define a command

3
00:00:14,880 --> 00:00:20,040
that should run before the main script runs.

4
00:00:20,550 --> 00:00:25,140
Now, you can define it at the global level or you can define it as the job level.

5
00:00:25,140 --> 00:00:31,590
Overriding the default configuration, the global configuration that you have, for example, that we

6
00:00:31,590 --> 00:00:35,280
can do is to add here and not before deploy production.

7
00:00:39,430 --> 00:00:41,380
You can add your own before script.

8
00:00:43,880 --> 00:00:46,490
And they call applying to production.

9
00:00:49,820 --> 00:00:55,290
Now, this will be executed before the main block script is executed.

10
00:00:56,180 --> 00:00:57,360
Why would you want to do that?

11
00:00:58,250 --> 00:01:00,440
You are not forced to use it.

12
00:01:00,470 --> 00:01:01,460
You can use it.

13
00:01:01,460 --> 00:01:09,290
If you find a scenario where running either a script globally before the script is being executed makes

14
00:01:09,290 --> 00:01:14,600
sense, or if you have something globally and you need to override it, that would be a possibility

15
00:01:14,600 --> 00:01:15,080
as well.

16
00:01:16,520 --> 00:01:22,100
What you will often seen some configurations, if you are looking at configurations that others have

17
00:01:22,100 --> 00:01:29,480
written for Forget Besigye, is that they install any dependencies that are needed for the specific

18
00:01:29,480 --> 00:01:32,070
job in the before script block.

19
00:01:32,600 --> 00:01:38,660
So, for example, in this case, we are installing Serj because we want to deploy something with search.

20
00:01:39,230 --> 00:01:44,900
Now, of course, this entire script blocker isn't that big, but sometimes the tools that need to be

21
00:01:44,900 --> 00:01:49,030
installed in order to run something can occupy a few lines.

22
00:01:49,700 --> 00:01:57,360
And what you can use before script is to make a separation between what is the actual script about.

23
00:01:57,890 --> 00:02:02,150
So, for example, in this case, we are simply deploying this project.

24
00:02:02,160 --> 00:02:05,250
So this is like the main functionality and the rest of it.

25
00:02:05,270 --> 00:02:08,630
For example, this installation, this is only need for this Destrehan.

26
00:02:09,440 --> 00:02:12,500
So what we can do is that we can move it to before script.

27
00:02:14,680 --> 00:02:21,040
And now if you look at the main script, it's simply script to call it that way, you can easily say,

28
00:02:21,040 --> 00:02:23,650
OK, in this step, this is what is being done.

29
00:02:23,920 --> 00:02:28,450
And the script is just like the set up in order to make everything work.

30
00:02:28,900 --> 00:02:33,700
And this can make your entire pipeline configuration easier to read.

31
00:02:36,020 --> 00:02:38,720
Now, if you want to use it or not, this is totally up to you.

32
00:02:38,960 --> 00:02:45,200
I just wanted to present you before this is something that you will see more often if the script runs

33
00:02:45,200 --> 00:02:49,430
a bit differently because the working directory will be set to default.

34
00:02:49,880 --> 00:02:55,730
And a context where the script around is totally different from before script and the script blocks.

35
00:02:55,970 --> 00:03:00,140
And for that reason, they have nothing to an example but all the documentation.

36
00:03:00,140 --> 00:03:07,160
And just to keep this in mind, before script after script exists, if you ever have the need of using

37
00:03:07,160 --> 00:03:09,730
them, feel free to check the configuration.

38
00:03:09,740 --> 00:03:10,760
It's much better.

39
00:03:11,030 --> 00:03:15,200
And for the rest of the scenario, we'll leave this as it is.

40
00:03:15,230 --> 00:03:20,650
So I'm going to reverse these changes and we'll leave everything in the script and will not use before

41
00:03:20,660 --> 00:03:21,080
script.

