1
00:00:01,530 --> 00:00:08,520
This lecture, we're going to take a look at how we can use the anchors from the Yamal language and

2
00:00:08,520 --> 00:00:12,270
apply that information to our digital IPSI pipeline.

3
00:00:14,020 --> 00:00:21,580
Now, if we take a closer look at our pipeline, we will see that we have a few jobs that aren't, in

4
00:00:21,580 --> 00:00:23,170
essence, quite similar.

5
00:00:24,160 --> 00:00:31,930
And from all jobs that we have deployed, job is more or less duplicated.

6
00:00:32,950 --> 00:00:38,790
So from all the jobs that we have, the deployed job, we have three instances.

7
00:00:38,800 --> 00:00:46,350
So we are deploying to the review server, we are deploying to the staging and we're deploying to production.

8
00:00:47,080 --> 00:00:54,730
And even if we simply compare, deploy staging and deploy production, we'll see that they are very,

9
00:00:54,730 --> 00:00:55,540
very similar.

10
00:00:56,440 --> 00:01:04,690
So what you will do is to try to find like what's similar in all this jobs and to extract that information

11
00:01:05,410 --> 00:01:07,390
to make the job much simpler.

12
00:01:08,450 --> 00:01:09,190
In this example.

13
00:01:09,610 --> 00:01:12,550
That application isn't that bad, but.

14
00:01:13,510 --> 00:01:20,050
In other more complex project, you can end up with job definitions, which are very similar, very

15
00:01:20,050 --> 00:01:27,100
long, and it doesn't make a lot of sense to make a change all over just because something is change.

16
00:01:28,180 --> 00:01:31,240
So let's try to extract specific information.

17
00:01:32,410 --> 00:01:33,800
So we'll do the following.

18
00:01:34,030 --> 00:01:36,880
Let's try and see if we can define a template.

19
00:01:42,220 --> 00:01:43,570
I'm going to call it deploy.

20
00:01:45,880 --> 00:01:46,900
This comtemplate.

21
00:01:49,850 --> 00:01:58,250
You won't see that by using the dot before it, this is disabled, so this will not be taken into consideration

22
00:01:58,250 --> 00:01:58,880
by Guillem.

23
00:02:00,150 --> 00:02:04,740
Now, let's take a look at both and see, which is similar to, for example, we have here this only

24
00:02:04,740 --> 00:02:07,590
configuration, which for both is the same.

25
00:02:07,590 --> 00:02:09,270
So we can start moving that.

26
00:02:13,360 --> 00:02:19,690
Additionally, if we look at a script itself, we'll see that that is pretty similar as well.

27
00:02:20,260 --> 00:02:21,820
There's only a small difference.

28
00:02:21,850 --> 00:02:25,000
This is using staging domain and this is using production domain.

29
00:02:25,360 --> 00:02:29,500
But I'm pretty sure that will be able to find a way around this.

30
00:02:30,370 --> 00:02:31,510
So I got to move this year.

31
00:02:33,350 --> 00:02:37,940
And instead of staging domain or production domain, let's just simply call it domain.

32
00:02:49,490 --> 00:02:55,670
Now, there's one more thing that we still need to do, first of all, we need to find a way to define

33
00:02:55,670 --> 00:02:56,470
these variables.

34
00:02:57,110 --> 00:03:00,920
So let's go here, create a variable configuration.

35
00:03:04,830 --> 00:03:06,720
And when we find a variable domain.

36
00:03:15,020 --> 00:03:20,180
And in this case, in the case of staging to take the value from staging domain.

37
00:03:33,790 --> 00:03:36,820
And if we look at production, we can use.

38
00:03:38,260 --> 00:03:38,950
Reduction.

39
00:03:41,510 --> 00:03:44,600
And if we go one step further and replace.

40
00:03:46,100 --> 00:03:53,240
This information from here, from the environment, we can see that even the environment is not that

41
00:03:53,450 --> 00:03:54,020
different.

42
00:03:54,870 --> 00:03:57,320
So let's copy the environment as well.

43
00:04:01,160 --> 00:04:06,560
Because we want to remove this key from here, because this is something that we cannot know.

44
00:04:12,010 --> 00:04:20,709
But apart from that, looks pretty good now in order to use this template inside our job configurations,

45
00:04:21,459 --> 00:04:25,750
we need to refer to this anchor and we haven't defined an anchor yet.

46
00:04:25,750 --> 00:04:27,380
So let's define this anchor.

47
00:04:27,400 --> 00:04:29,050
Let's call it deploy.

48
00:04:34,070 --> 00:04:35,960
And in order to use the anchor.

49
00:04:41,670 --> 00:04:47,070
We're going to use it like that, and what this will do is to march this new configuration into one.

50
00:04:50,460 --> 00:04:51,660
But this is for the police.

51
00:04:52,740 --> 00:04:53,490
This is for.

52
00:04:54,720 --> 00:04:55,830
Deploy production.

53
00:05:01,140 --> 00:05:06,360
The next step will be to take this configuration that we have here and try to validate it.

54
00:05:06,570 --> 00:05:09,300
So I'm going to select it and I'm going to copy it.

55
00:05:10,840 --> 00:05:17,090
Now, I'm here at krp, at my project, and I'm going to go from the left menu to secede.

56
00:05:19,610 --> 00:05:23,390
Right here on top, you should notice a button called Silent.

57
00:05:25,350 --> 00:05:33,120
This tool helps us verify our catalepsy lapse YAML file, and this is especially useful if something

58
00:05:33,120 --> 00:05:39,430
doesn't work or before committing, if we are not sure that what we have done there is actually valid.

59
00:05:39,840 --> 00:05:42,870
Well, A simply pays the content here and a click on Validate.

60
00:05:44,670 --> 00:05:52,230
You will see that I will have an error saying Syntex is incorrect and will say a specific error, and

61
00:05:52,230 --> 00:05:58,770
that's quite helpful because I can then have a look at the line that is being indicated 102.

62
00:05:59,980 --> 00:06:06,300
And I'll be able to see that in this case, I haven't I don't have the right indentation for variables,

63
00:06:06,970 --> 00:06:09,020
so this is not correct.

64
00:06:09,040 --> 00:06:13,090
So if I make now the correct indentation, let's see if it works.

65
00:06:13,810 --> 00:06:15,820
And it says Syntex is correct.

66
00:06:16,480 --> 00:06:22,210
Not what I actually wanted to see if this configuration, if this template that we have used here has

67
00:06:22,210 --> 00:06:24,580
been properly picked up.

68
00:06:25,420 --> 00:06:32,650
So if we take a look at the deploy staging job, we should see a couple of things which would see that

69
00:06:32,650 --> 00:06:34,310
only master has been set.

70
00:06:34,340 --> 00:06:35,980
The script has been said.

71
00:06:36,490 --> 00:06:39,280
So let's go to deploy staging.

72
00:06:40,420 --> 00:06:47,230
Now, what this does is list all the jobs that are here and it explains what Gottleib has understood

73
00:06:47,230 --> 00:06:47,740
from this.

74
00:06:49,290 --> 00:06:50,820
So this is the staging.

75
00:06:53,090 --> 00:06:57,320
You will see here that we still have NPM install installing surge.

76
00:06:58,900 --> 00:07:02,500
This is actually a display problem that Gottleib is having.

77
00:07:02,830 --> 00:07:07,080
This is the other command that we have where we are actually deploying to search.

78
00:07:07,900 --> 00:07:13,780
So at least from what we see here, it seems to be working properly and this configuration has been

79
00:07:13,780 --> 00:07:15,190
correctly being picked up.

80
00:07:15,880 --> 00:07:18,430
So I'm confident now that I can commit it.

81
00:07:18,580 --> 00:07:20,410
And let's see, it's on in action.

82
00:07:22,540 --> 00:07:28,930
I have now created a request and I have merged that specific branch and now the pipeline for Master

83
00:07:28,930 --> 00:07:32,650
has been started and completed successfully.

84
00:07:32,980 --> 00:07:37,630
Now I can see that the staging and production work without any issues.

85
00:07:37,880 --> 00:07:44,230
And if I'm just interested in seeing if everything actually worked well, I can simply go inside a job

86
00:07:44,230 --> 00:07:50,770
and see that all the steps and all the stages, as they were before, have been used, that the proper

87
00:07:50,770 --> 00:07:54,100
domain name has been used and that everything has been properly deployed.

88
00:07:55,450 --> 00:08:02,800
So using this technique, you can go ahead and do the next step on your own, so we have defined this

89
00:08:02,800 --> 00:08:09,190
template deploy template and we have used it for the staging and deployed production actually deploy

90
00:08:09,190 --> 00:08:11,370
review is quite similar.

91
00:08:11,740 --> 00:08:17,950
And I wanted to give you the opportunity to try it on your own so that you can get some real world experience

92
00:08:17,950 --> 00:08:23,560
on adapting this to make sure that all the deploy stages now use this template.

93
00:08:23,980 --> 00:08:28,390
And as you have seen, even this configuration is pretty simple.

94
00:08:28,780 --> 00:08:37,840
It is nice now to have a central way where you can optimize or change this code without having to update

95
00:08:37,840 --> 00:08:42,400
each and every of these environments or each of these jobs that you have there.

